multiple monitors - Determine windows display number and/or layout via java -


i have fullscreen java app run on 8 monitor digital signage type display on windows 7 machine. need able display content on specific physical monitors. ideally displays ordered 1-8 in display properties -> settings, many attempts of unplugging/plugging in , reordering have failed physical monitors appear in deterministic order via display properties->settings. can reorder them fine, when java program retrieves information on displays not in layout/order windows has them configured.

graphicsenvironment id returns strings such device0 , device1, these not match windows display numbering seen in display properties. instance if layout 7,4,1,2,3,4,5,6 still device0, device1... in device0 corresponds identified screen 1 (not 7 first screen on left). there way query os determine layout displays in and/or other technique display fullscreen on specific physical monitor?

you can bounds of screens relative big virtual desktop:

graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); (graphicsdevice gd : ge.getscreendevices()) {     rectangle bounds = gd.getdefaultconfiguration().getbounds();     system.out.println(bounds.tostring()); } 

for setup gives:

java.awt.rectangle[x=0,y=0,width=1280,height=1024] java.awt.rectangle[x=1280,y=304,width=1280,height=720] 

you can use information determine order. e.g. if absolutely sure monitors in nice grid can go fullscreen on upper right monitor this:

graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); graphicsdevice gdupperright = null; rectangle bupperright = null; (graphicsdevice gd : ge.getscreendevices()) {     rectangle b = gd.getdefaultconfiguration().getbounds();     if (bupperright == null || b.x > bupperright.x || b.y > bupperright.y) {         bupperright = b;         gdupperright = gd;     } }  gdupperright.setfullscreenwindow(myframe); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -