File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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.
I agree. Here's the link:
subject: Positioning controls on a GridBagLayout
It's not a secret anymore!