I have a panel which comes on top of another panel which is made using JWindow. I want to set this top panel go fullscreen when a button is clicked. I searched in for long time but couldn't find a solution.
Asked
Active
Viewed 640 times
-1
-
1*"..and components inside it also should adjust accordingly"* [Layout managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html). – Andrew Thompson May 25 '14 at 11:35
1 Answers
0
This solution takes the current screen dimensions and sets the frame size to it. The setSize() call also exists for JWindow.
frame = new JFrame("Test");
Toolkit tk = Toolkit.getDefaultToolkit();
int xSize = ((int) tk.getScreenSize().getWidth());
int ySize = ((int) tk.getScreenSize().getHeight());
frame.setSize(xSize,ySize);
source: http://www.coderanch.com/t/341780/GUI/java/set-Jframe-full-screen

Roy Iacob
- 412
- 3
- 13