Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GridBagLayout resizing problem...

 
hatim osman
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there...

I'm having problems creating my GUI using GridBagLayout. My design is pretty simple:

I am placing my JTable in the first row and instructing its constraints to occupy all available cells horizontally. I want to place the following in the second row.

3 lables, 2 text fields, a combo box and 3 buttons.

here's the constraints for the components:



when the frame is made visible, everything is fine, and when I resize the frame it also works fine. the thing is when i resize the frame to a smaller size, I don't like the behavior of the 2 JTextFields because they resize in a very small size, I thought about setting their weightx, but the problem still presists, I can't set the weightx for all the components in the second row, because i don't want the JComboBox and JButton(s) to lose their size....please help me

Thanx in advance
Hatim

[Andrew: changed subject line. Refer to "Ease Up" and "Use A Meaningful Subject Line" for more information.]
[ January 31, 2006: Message edited by: Andrew Monkhouse ]
 
Abiodun Okusolubo
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hatim, I had a similar problem when I tried to use gridbag. It took me a lot of time, and later i discovered it does not worth it, because there will always be a movement of some kind with gridbag with adding new component. If you can, use SpringLayout. It is really fantastic, the components don't move a bit, you can position anywhere relative to any thing.

Later.
 
hatim osman
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...
Ok, I will give the SpringLayout a shot, and update you on how things are going.

Hatim
Thanx
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic