This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes frame resize Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "frame resize" Watch "frame resize" New topic
Author

frame resize

praveen shinde
Ranch Hand

Joined: Jun 03, 2009
Posts: 63
Hello
I have a frame which consist of several textfield, combobox, panels etc. When I run the program all the components are not arranged properly. But when I maximize the frame all the components are arranged properly. I tried changing the size of the frame. But it didn't work.
Thanks
Praveen
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2177
    
    7
You question is too vague to give any specific help so all I can do is suggest you read the section from the Swing tutorial on Using Layout Managers for working examples.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

Are you adding your components after the call to JFrame#setVisible(true)?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
praveen shinde
Ranch Hand

Joined: Jun 03, 2009
Posts: 63
I have added all the components to the frame and then used JFrame#setVisible(true)
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
almost certainly you are using the wrong layout manager
Bharath Raja
Ranch Hand

Joined: Jan 21, 2009
Posts: 111
try to use the pack() method of JFrame class


Life is either daring something or nothing - Helen Keller
 
Consider Paul's rocket mass heater.
 
subject: frame resize