Removing the three dots "..." from a JButton?

Stan picture Stan · Apr 27, 2011 · Viewed 10.9k times · Source

Hey, I am creating a calculator program, with some small buttons, I want one of the buttons to have "Ans" on them, but whenever I make the JButton smaller then 50, 50, it will show three dots. "...", how can I remove these dots and show the normal text given?

Answer

lukastymo picture lukastymo · Apr 27, 2011

Probably this because margin of your button is too big.

Try this:

myButton.setMargin(new Insets(0, 0, 0, 0));

You can also turn off border:

button.setBorder(null);