wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes GridBagLayout squishes components on 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 "GridBagLayout squishes components on resize" Watch "GridBagLayout squishes components on resize" New topic

GridBagLayout squishes components on resize

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Hi Guys :

Im using GridBagLayout to layout 5 components. Im not trying
to do anything fancy...
All the components being added below are scrollpanes
with Jtables inside. When I have a maximized window,
the layout is fine, but my problem is that if I resize the window, all the
components get squished together in a really small area
in the center of the screen... Any ideas ?

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
try adding (to each of your constraints)

[constraints].weightx = .5;
[constraints].weighty = .5;
I agree. Here's the link: http://aspose.com/file-tools
subject: GridBagLayout squishes components on resize
It's not a secret anymore!