• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GridBagLayout squishes components on resize

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try adding (to each of your constraints)

[constraints].weightx = .5;
[constraints].weighty = .5;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic