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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "frame resize" Watch "frame resize" New topic

frame resize

praveen shinde
Ranch Hand

Joined: Jun 03, 2009
Posts: 63
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.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2454
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: 10828

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
I agree. Here's the link:
subject: frame resize
It's not a secret anymore!