Right now, I have a full screen application which spawns several full screen JFrames based on a configuration file (so I can never predict exactly how many frames I will have). These JFrames are in full-screen mode, like this:
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setUndecorated(开发者_开发百科true);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setBounds(0,0,screenSize.width, screenSize.height);
The problem is, these JFrames are misbehaving in a Linux environment. I struggled a whole lot with requestFocus
, requestFocusInWindow
, toFront
, setVisible
, etc. But nothing seems to get it to work properly in Linux. The issue lies in the fact that I have several frames and I need to be able to switch between them when I click on a button (it's basically a menu).
So I'm starting to think a JFrame isn't the best object to use. Would it be easier to manager multiple frames if they were, say optionPanes? Or something similar? Whatever the solution, I need to be able to DO_NOTHING_ON_CLOSE
and setUndecorated
(or something similar).
Note: If you don't see a reason I need to change my JFrame and would know how I can switch focus/view easily, please let me know. This would also be an answer to my problem.
i dont see your call to set the screen to fullscreen ?
http://download.oracle.com/javase/tutorial/extra/fullscreen/exclusivemode.html
I have decided to use the cardLayout
and changing my code around a little bit.
精彩评论