Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

make the last button align horizontally with other components

 
Raymond Poon
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2559
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can post image of your existing gui
 
Rob Camick
Ranch Hand
Posts: 2559
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can post image of your existing gui


Run the posted code and you can see the exact behaviour.
 
Raymond Poon
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic