Skip to content
Advertisement

How to get rid of text outline on JButton

I’m making a program which includes JButtons with the text “+” and “-” on them. Why does the JButton have an outline around the text within? How do I get rid of the square around the text for a cleaner look?

Image here shows the issue on the first red button.

GUI image

Advertisement

Answer

Use the jbutton.setFocusPainted(false); method.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement