This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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:
subject: GridBagLayout squishes components on resize
Similar Threads
GridBagLayout..Please check my code..
How to (re)paint an AWT applet faster
buttons that are not same size
how to align components in GridBagLayout in JAVA swing
How to stop JTextField collapsing when using GridBagLayout?