Sukupa91
Sukupa91

Reputation: 133

Java Swing Application for specifying the size of frame

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

Answers (3)

Suzon
Suzon

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

3751_Creator
3751_Creator

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

RKC
RKC

Reputation: 1874

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

Upvotes: 0

Related Questions