• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFrame maximized, display taskbar

 
Matti Poro
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I set a JFrame maximized so that it won't hide the taskbar?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
either of these don't hide the taskbar for me

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
(or setExtendedState(MAXIMIZED_BOTH) if extending JFrame)

or

Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize(dim.width,dim.height); (or just setSize(dim.width,dim.height))
(this way ensure there is no setLocation() in your code)
 
Matti Poro
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, both ways hide the taskbar on my Windows XP.
 
Matti Poro
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved it.



This makes it to take the whole screen. It doesn't do that if I remove the setDefaultLookAndFeelDecorated(true).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic