Question

One of my coworkers would like my Swing app to adapt correctly to the removal of a 2nd display monitor.

Is there any way to get notification of this, other than polling to repeatedly compute virtual bounds? (per the code sample in http://download.oracle.com/javase/6/docs/api/java/awt/GraphicsConfiguration.html)

No correct solution

OTHER TIPS

Hum, tricky one. Because GraphicsConfiguration class won't give us any listeners, I'll have only a couple of alternatives:

  1. (If Windows) Use a JNI interface to Windows to detect display settings change and forward them to Java. This would be the SystemEvents::DisplaySettingsChanged Event.

  2. Create a simple polling Thread - timer that retrieves the result of Toolkit.getDefaultToolkit().getScreenSize() as you've already stated before.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top