How to get rid of text outline on JButton

Tags: , ,



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

Answer

Use the jbutton.setFocusPainted(false); method.



Source: stackoverflow