简体   繁体   中英

How to bring Swing window offscreen?

I work on a Java Swing application that allows displaying frames scattered on multiple screens.

The problem is, when in dual screen, a frame can be saved in secondary monitor 2 but when the application is loaded on only one monitor, the frame is off-screen and hence is not visible.

Does someone knows a way to identify and recover the frame to the main screen using Java Standard API?

I think you could use:

public abstract GraphicsDevice[] getScreenDevices() throws HeadlessException 

Returns an array containing all the GraphicsDevice objects that represent screen devices

http://docs.oracle.com/javase/6/docs/api/java/awt/GraphicsEnvironment.html#getScreenDevices()

if this method give you list of two or more items then you have multimonitor environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM