Java – how to clear the border around the button?

I have a JPanel with GridLayout I have a button in each cell of the grid I see that each button is surrounded by a gray border I want to delete these borders Does anyone know how to do it

Solution

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

For more details about boundaries, see borderfactory

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>