Java Swing - Detect which display a JFrame is displayed on -


i aware this question can current displays graphicsdevice[] in swing application following code:

graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); graphicsdevice[] gd = ge.getscreendevices(); 

i understand here set device myself, let user select use in menu, etc. goal detect of these graphicsdevices application displayed in, can default fullscreening in current graphicsdevice without bothering user.

i using code following fullscreen application:

jframe frame = new jframe();  // ... when want fullscreen: graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); graphicsdevice gd = ge.getdefaultscreendevice(); if (gd.isfullscreensupported()){     frame.dispose();     frame.setundecorated(true);     frame.setalwaysontop(true);     gd.setfullscreenwindow(frame);     frame.setvisible(true); } 

i cannot find in graphicsdevice or graphicsenvironment apis current graphicsdevice jframe displayed on. aware there may possible hacks positioning window directly (as described in link above), wondering if there easier/more elegant solution.

graphicsdevice device = jframe.getgraphicsconfiguration().getdevice() 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -