Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove border around buttons?

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?

like image 537
Roman Avatar asked Apr 26 '10 11:04

Roman


People also ask

How do you hide the outline of a button?

Show activity on this post. So use border: none; and that annoying blue border shall disappear!

How do I remove the button focus outline?

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.


1 Answers

Border emptyBorder = BorderFactory.createEmptyBorder();
yourButton.setBorder(emptyBorder);

For more details on borders see the BorderFactory

like image 86
Eric Eijkelenboom Avatar answered Sep 20 '22 11:09

Eric Eijkelenboom