aspose file tools*
The moose likes Java in General and the fly likes Auto Maximise GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Auto Maximise GUI" Watch "Auto Maximise GUI" New topic
Author

Auto Maximise GUI

Zahid, Butt
Ranch Hand

Joined: Feb 16, 2001
Posts: 100
Hi
I have the following code :
import java.awt.*;
public class TestFlow extends Frame {
public static void main(String args[]) {
Panel p = new Panel();
Button b = new Button("NORTH");
Button b1 = new Button("SOUTH");
Button b2 = new Button("CENTER");
TestFlow t = new TestFlow();
t.setSize(450,450);
t.setVisible(true);
t.add(p);
p.add(b);
p.add(b1);
p.add(b2);
}
}
How do I maximise the panel to be the size of my Monitor screen ?

Thanks in advance.
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
hi you can use this
Dimenstion d = getToolkit().getDefaultScreenSize();
i can't remember the exact method but something like this and then set it to setSize(d)


Val SCJP <BR>going for SCJD
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The last I heard, there was no way to programatically maximize a window without using JNI. The best you can do is set its size equal to the size of your screen (which isn't really the same as miximizing it). There are some resources on the internet that show how you can do this using JNI, if you're interested.
Zahid, Butt
Ranch Hand

Joined: Feb 16, 2001
Posts: 100
Hi
Bodie, could you please give me URL's that further explain your comments.
Thanks.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Java doesn't provide any way to maximize a JFrame. On a Windows platform, this can only be achieved via the use of native code. This requires using JNI to integrate native code with your Java program. You can find a JNI tutorial here. I used to have a link to some C code that handled the maximization of the window, but I can't find it now that I need it. Sorry.
HTH
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Auto Maximise GUI