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 noti开发者_如何学Pythonfication 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)
Hum, tricky one. Because GraphicsConfiguration class won't give us any listeners, I'll have only a couple of alternatives:
(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.
Create a simple polling Thread - timer that retrieves the result of Toolkit.getDefaultToolkit().getScreenSize() as you've already stated before.
精彩评论