• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help! Can i open a frame to fit the dimensions of the monitor

 
Sam Kebab
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a method to call in order to set the size of the frame/jframe to exactly the size of the monitor?
At the moment i manually set the width and length of my frame to match the size of the monitor; but what if my client uses another size of monitor.
Thanks in advance.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are are using JDK1.3 you can use
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
then use screen.width and screen.height.
If you are using JDK1.4 there is actually a method for maximizing the Frame but I can't remember what the method is. Sorry
Hope that helps.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The new way to actually make a frame maximized in 1.4 is


The frame already needs to be visible for this to work, however, and I would also set the size of the frame before this, because if the user un-maximizes the frame, it will go back to the size you set it at, which would just be the titlebar if you don't set a size.

-Nate
 
Sam Kebab
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys.
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Nathan. i have been wondering how to do it too.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic