Reputation: 31
I'm fighting with this kind of problem. My app creates two frames. First one is for the operator and it should be on first monitor in normal mode. The other one is kind of Display for "customers" and should be displayed in Fullscreen on the second monitor. I decided to use Fullscreen Exclusive because of easyness. The thing is that it's easy to display the frame on monitor 0 but I'm unable to force choosing second one. The frame still displays in monitor number 0 not 1.
GraphicsDevice screen = GraphicsEnvironment.
getLocalGraphicsEnvironment().getScreenDevices()[1];
//it is in program config which display should be used.
//Of course monitor is present and listed by getScreenDevices as array[1]
JFrame frame = new JFrame("Fullscreen Display");
if (screen.isFullScreenSupported()) {
frame.dispose();
frame.setUndecorated(true);
System.out.println("FEM available on: "+ screen.getIDstring());
frame.repaint();
screen.setFullScreenWindow(frame);
}
Upvotes: 2
Views: 1880
Reputation: 595
I just ran your code and I can successfully change which screen your frame pops up in. If you change the 1 to a 0 on this line --->
GraphicsDevice screen = GraphicsEnvironment.
getLocalGraphicsEnvironment().getScreenDevices()[1];
the frame appears on the other monitor.
Upvotes: 1