jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes Why does this component appear shrunken ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Why does this component appear shrunken ?" Watch "Why does this component appear shrunken ?" New topic
Author

Why does this component appear shrunken ?

Colm Dickson
Ranch Hand

Joined: Apr 04, 2009
Posts: 89
Hi all.

I have some components on a panel and then add this panel to a container and then have my frame displayed as the result of an ActionListener on a button. Why is it that my frame is displayed but is miniscule and looks minimised, only showing the title bar?

This is really annoying. setVisible is set to true and when I expand the frame all my components appear but it will not appear correctly from the oiutset. This has to be something simple I'm missing. Any help much appreciated, thanks.




....all I see is the start of the dialog title 'Add New..'

Thanks.

Colm

pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561


It's only doing what you tell it to.

Myself, I'd try to use a combination of layouts, and then let the individual layout managers set the best size to display their contents. I'd also call pack on the window before displaying. e.g.,

Colm Dickson
Ranch Hand

Joined: Apr 04, 2009
Posts: 89
Thanks Pete,

That's it....I never even thought that my preferred size was the issue here ....

Cheers,

Colm
 
wood burning stoves
 
subject: Why does this component appear shrunken ?
 
Similar Threads
JDialog: How to set focus on second JButton?
panel and image problem
container's containment
Painting from one class to another
input errors in JDialogs