JAVA set JFrame full screen (Maximised)

The code to maximise a JFrame:

Frame.setExtendedState(MAXIMIZED_BOTH);

This will maximise the JFrame mimicking the actions as if the option was selected from the frame.

The following code sets the size of the JFrame relative to the screen size:

Dimension scrn = getToolkit().getScreenSize();
Frame.setBounds( 0, 0, scrn.width, scrn.height – 30);

in this case the frame is not technically maximised, leaving the frame edges visible on screen.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s