Alright, well, this is my 2nd post so far... My first problem was easily repaired ( I incremented an i instead of j in one of my for loops... lol ). But this problem is a little more, how can I say, not a visual mistake, but a implementation thing...

Again, this is the minesweeper game I'm trying to do... Here's my problem, best explained with a picture: (i guess img tags dont work)

I'm trying for the picture on the right with small boxes and regular font text, but it seems like I need each button to be a certain width to fit anything in there.. Is there a way to change that so the text fits perfectly, centered inside each button without the cap on width? The hight seems to not matter in this case, which is weird to me...

Any advice? Again, each one of those boxes are JButton. I am using b.setText("") to enter the text into the buttons when a click is heard.

10 Years
Discussion Span
Last Post by peter_budo

wow... This always happens... I figured it out..

For anyone else wondering/later searches:
BUTTON.setMargin(new Insets(0,0,0,0));
fixes the problem...


Nice one.
Can you please mark this post as solved? Below last post is link that reads "Mark as solved" or something like that, thanx...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.