File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
How to stop JTextField collapsing when using GridBagLayout?
buttons that are not same size
how to align components in GridBagLayout in JAVA swing