Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

button sizes  RSS feed

 
Thomas Paul Bigbee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a number of buttons on my gui, and would like them to be the same size, however the text inside of them make their sizes all different, how do I make them all the same size?

Thanks in advance
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a couple of the options:

1. if grouped together, put them in a panel set as a gridlayout (eg 1 row, 4 columns).
2. you could use setPreferredSize(), but this is not guaranteed
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!