JAVA set JFrame full screen (Maximised)

The code to maximise a JFrame:


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.

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s