This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Positioning controls on a GridBagLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Positioning controls on a GridBagLayout" Watch "Positioning controls on a GridBagLayout" New topic

Positioning controls on a GridBagLayout

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
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?

Sloan Bowman
Ranch Hand

Joined: Jan 21, 2003
Posts: 107
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Positioning controls on a GridBagLayout