This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell 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


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Positioning controls on a GridBagLayout" Watch "Positioning controls on a GridBagLayout" New topic
Author

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?

Thanks.
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.
 
GeeCON Prague 2014
 
subject: Positioning controls on a GridBagLayout