Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Positioning controls on a GridBagLayout

 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a GridbagLayout which has a JButton on the left and 2 JComboBoxes
on the right. How can I set the contraints so if the panel is stretched
the 2 combo boxes remain on the right of the panel?

Thanks.
 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should create your constraints so the right hand has a higher weight. For example.

constraint = new GridBagConstrait(1,1, 1,1, 1.0, 1.0 etc...

If you post some code I'll be glad to help you out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic