Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to make square (same width & height) buttons

807601May 14 2008 — edited May 15 2008
I'm making a grid of JButtons and I want the buttons to be square (same width and height). I've tried setPreferredSize and setMinimumSize. I can adjust the Dimension object given to setPreferredSize so I get what looks like square buttons in a 4x4 grid but if I then change to a 10 x 10 grid the buttons are no longer square. Any advice would be appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 12 2008
Added on May 14 2008
6 comments
859 views