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.