Transparency of a JButton

0

good evening. I'm trying to create a transparent button with the setOpaque () method and I can not. Anyway I'm wrong method, who knows how to do it?

    
asked by D3n3cry 30.12.2017 в 22:11
source

2 answers

0

you can make the button transparent by modifying its color, and changing the Opaque property to false, it would be like this:

JButton jButton1=new JButton();
jButton1.setOpaque(false);
jButton1.setBackground(new Color(0,0,0,0));

I hope I have helped you.

    
answered by 31.12.2017 в 17:30
0

actually I saw what happened xDD I did the buttons in another JPanel on top of another JPanel and that's why when I put those commands was transparent yes, but what you saw was the background jpanel default and not the sheet that there was below

    
answered by 01.01.2018 в 16:40