How to remove the border of text in a component?

1

I have a program in Java and would like to remove these borders that appear in the button text:

(The red borders were in the edition the ones I want to remove are those dark blue inside the red ones)

    
asked by anonymous 02.09.2015 / 22:57

2 answers

0

Set Component#setFocusable() with false causes that border around the text to be removed. In fact this is indicative that the component is focused.

JButton foo = new JButton();
foo.setFocusable(false);
    
02.09.2015 / 23:41
1

You can remove as renan has spoken but will run out of focus to access the buttons with the tab and the spacebar for example.

setFocusable(false);
    
03.09.2015 / 16:53