aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Help! Can i open a frame to fit the dimensions of the monitor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help! Can i open a frame to fit the dimensions of the monitor" Watch "Help! Can i open a frame to fit the dimensions of the monitor" New topic
Author

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

Sam Kebab
Ranch Hand

Joined: Jan 23, 2002
Posts: 104
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
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Sam Kebab
Ranch Hand

Joined: Jan 23, 2002
Posts: 104
Thanks guys.
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
thanks Nathan. i have been wondering how to do it too.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help! Can i open a frame to fit the dimensions of the monitor