File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply 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
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

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

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help! Can i open a frame to fit the dimensions of the monitor
 
Similar Threads
Different font size on different monitors?
Monitor Size
get the size of the full screen in current settings(urgent)
full size of the screen(urgent)
Doubt in AWT