Two Laptop Bag
The moose likes Swing / AWT / SWT and the fly likes Maximising Frame window to fit to screen Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Maximising Frame window to fit to screen" Watch "Maximising Frame window to fit to screen" New topic
Author

Maximising Frame window to fit to screen

Arun Sanker
Ranch Hand

Joined: Mar 21, 2007
Posts: 44
Hi Guys,

Iam new to Swing &about to start with my first GUI.
Had some questions to begin with.Thought of asking the experienced guys over here.

I have JFrame,as my top level container.want the frame to be maximised or fit to the screen of the computer on which it is running?.What is the best way to do it.

Also,In the content pane of the Frame,some components are to be added.

Should I use the frame's content pane or should I create a JPanel & make it,the contentpane of the frame & then add the components to the panel.What is the best way to do it?
For the panel,I intend to use the gridbaglayout.

Thanks in advance
K
Fon Drank
Greenhorn

Joined: Feb 20, 2007
Posts: 14
For the frame, use


For adding components, use
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32712
    
    4
Welcome to the Ranch kohinoor. Please correct your displayed name to the Ranch's naming policy.

If you are using a version of Java more recent than 1.4 (ie 5 or 6) you don't need to bother with content panes. You can write:CR
Arun Sanker
Ranch Hand

Joined: Mar 21, 2007
Posts: 44
Thank you guys...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Maximising Frame window to fit to screen
 
Similar Threads
how to place Panel into Frame
Newbie question on content pane
How to Add Scroll bars to a frame
JFrame, JPanel and sizes
Setting frame minimum size