I have a JPanel with the GridLayout. In every cell of the grid I have a button. I see that every button is surrounded by a gray border. I would like to remove these borders. Does anybody know how it can be done?
Show activity on this post. So use border: none; and that annoying blue border shall disappear!
To remove focus around the button outline:none property is used. Outline property: Outline is an element property which draws a line around element but outside the border. It does not take space from the width of an element like border.
Border emptyBorder = BorderFactory.createEmptyBorder();
yourButton.setBorder(emptyBorder);
For more details on borders see the BorderFactory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With