views:

423

answers:

1

I prefer buttons with minimal margins, about as wide as their text caption. Is there a way to achieve that in a JButton in Swing?

What I am seeing in practice now is that even if I try to use setMaximumSize() and similar, it just ends up eating the text caption, cutting it off to the right. But it does not reduce the margins.

+4  A: 

I believe setMargin is what you're looking for.

myButton.setMargin(new Insets(0, 0, 0, 0));
Michael Myers
I concur. You beat me to it.
chris
yep, this worked. Thanks a lot.
EndangeringSpecies