Help! Can i open a frame to fit the dimensions of the monitor
Sam Kebab
Ranch Hand
Joined: Jan 23, 2002
Posts: 104
posted
0
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.
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.
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
posted
0
Thanks guys.
Roy Ben Ami
Ranch Hand
Joined: Jan 13, 2002
Posts: 732
posted
0
thanks Nathan. i have been wondering how to do it too.