Hamad Mohammad
Hamad Mohammad

Reputation: 23

JButton with no background

Thank you for your kind, we learned from you many times. I have xJButton class inherits JButton class.

I am doing this to add an image as icon and change it after it clicked.

I do not want the blue color to be as background and also i don't want any border on it.

Everything is working vine, except the border.

You can see there is 2 borders

enter image description here

setOpaque(false);
setContentAreaFilled(false);
setBackground(null);

can you help me?

Upvotes: 1

Views: 120

Answers (1)

NRKirby
NRKirby

Reputation: 1634

You should be able to do it like this:

xJButton.setBorder(null);
xJButton.setBorderPainted(false);
xJButton.setContentAreaFilled(false);
xJButton.setOpaque(false); 

Upvotes: 1

Related Questions