问题
I am writing a java application that takes advantage of a dual monitor set up. I have two windows:
- Window 1 - Main GUI
- Window 2 - Full Screen on Second monitor
My Problem: The second window only stays full screen when it has the focus. If I click back on window 1 or change the focus to something else, window 2 minimizes. Is there someway to make window 2 stay full screen when it doesn't have focus?
Here is my code for making the second window full screen on the second monitor:
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setUndecorated(true);
frame.setVisible(true);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gd = ge.getScreenDevices();
gd[1].setFullScreenWindow(frame); //gets the 2nd display.
回答1:
Try getting the size of the second monitor then instead of setting the fullscreen monitor set the size of the the second frame. Also try setting the second frame to always on top.
来源:https://stackoverflow.com/questions/24704208/java-keep-window-fullscreen-in-second-monitor-when-not-focused