0

I see many questions about how to maximize a JFrame without hiding the task bar, but in my case the question is just the opposite. I'm trying to use all of the screen including the task bar in order to have more room for my application. Why does my app not use the whole screen?

Here is what I do:

frame.setExtendedState(frame.getExtendedState() | frame.MAXIMIZED_BOTH);
frame.setVisible(true);

(I work on Mac OS X 10.7)

mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • 2
    *"I'm trying to use all of the screen including the task bar in order to have more room for my application."* Use the [Full-Screen Exclusive Mode API](http://docs.oracle.com/javase/tutorial/extra/fullscreen/).. – Andrew Thompson Mar 23 '14 at 09:15
  • 3
    A complete example is shown [here](http://stackoverflow.com/q/12751704/230513). – trashgod Mar 23 '14 at 10:32
  • @mKorbel, thank you very much. This (using the Full-Screen Exclusive Mode API) works for me! – John Hessing Mar 26 '14 at 07:03

1 Answers1

0

Why does my app not use the whole screen?

Because most apps want to keep the task bar available so user have easy access to other applications, so the behaviour of extend state method is to exclude the task bar from the maximum size.

I'm trying to use all of the screen including the task bar

You can manually set the size.

frame.setSize( Toolkit.getDefaultToolkit().getScreenSize() );
camickr
  • 321,443
  • 19
  • 166
  • 288
  • @JohnHessing, works for me (although I use Windows). Post your [SSCCE](http://www.sscce.org/) so I can test it on Windows and others can test it on a Mac. – camickr Mar 26 '14 at 01:08
  • thank you for the option but I'm happy to tell you my problem is solved. I tried the suggestion mentioned by mKorbel and it works fine! – John Hessing Mar 26 '14 at 07:03