سؤال

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top