Reputation: 133
I am making an application where am using some Jframes, couple of buttons .
But the problem is I am using jframe.setsize(1366,786) for specifying the size of frame , what if i will use this software in a maching with large wide screen monitor . Suppose 1600*900 .
How can i specify to occupy the complete screen by jframe??
Upvotes: 0
Views: 78
Reputation: 759
If we want to get width & height of window then try this:
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int scrHeight = screenSize.height ;
int scrWidth = screenSize.width ;
Upvotes: 2
Reputation: 664
Your can open it maximized by using setExtendedState
.
setExtendedState(JFrame.MAXIMIZED_BOTH);
You can look at the JavaDoc for more info http://docs.oracle.com/javase/8/docs/api/java/awt/Frame.html
Upvotes: 3