aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes make the last button align horizontally with other components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "make the last button align horizontally with other components " Watch "make the last button align horizontally with other components " New topic
Author

make the last button align horizontally with other components

Raymond Poon
Greenhorn

Joined: Feb 22, 2011
Posts: 4
The right hand side of the last button of this program does not align horizontally with other components (e.g. JTextField).
How to make the right hand side of the last button ("b4") align horizontally with other components ?

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2172
    
    7
Check out the solution in this posting for creating the button panel:

http://www.coderanch.com/t/528119/GUI/java/Position-buttons-GridBagConstraints-Swing
vibhas bhingarde
Greenhorn

Joined: Feb 22, 2011
Posts: 11
can post image of your existing gui
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2172
    
    7
can post image of your existing gui


Run the posted code and you can see the exact behaviour.
Raymond Poon
Greenhorn

Joined: Feb 22, 2011
Posts: 4
Another question is:
Executing setMinimumSize do not set the panel to a minimum size - the panel can be reduced to a very small size.
Raymond Poon
Greenhorn

Joined: Feb 22, 2011
Posts: 4
Rob Camick wrote:Check out the solution in this posting for creating the button panel:

http://www.coderanch.com/t/528119/GUI/java/Position-buttons-GridBagConstraints-Swing


Using a horizontal BoxLayout solves the problem.
Thanks!
 
Don't get me started about those stupid light bulbs.
 
subject: make the last button align horizontally with other components