how to maximize JFrame

How can I expand my JFrame so it occupies the entire display area of the monitor regardless of screen resolution?
confusednewguyAsked:
Who is Participating?
 
hoomanvCommented:
instead of
    frame.setVisible(true);
use
    GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(frame);

you can also do
    frame.setUndecorated(true);
to be completely fullscreen
0
 
kjetijoCommented:
By using a toolkit you can get the resolution of the screen... In one line you could just write:

setSize(Toolkit.getDefaultToolkit().getScreenSize());

This won't put you into a fullscreen-mode since you'll still have the borders around the JFrame, and you can still resize it. To get fullscreen, you use the command, as hoomanv allready said:

setUndecorated(true);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.