1

Can anyone please tell how to delete the color from the background of a JLabel in Java?

I used these commands to color its background :

R1L1.setBackground(Color.red);
R1L1.setOpaque(true);

Now i have tried setOpaque to false but it doesn't seem to work. Can anybody help?

David Yee
  • 3,515
  • 25
  • 45
Haider Ali
  • 37
  • 1

1 Answers1

0

I found a question like this one (Make JLabel background transparent again). You should be updating the label when you change make it opaque or not, like so:

R1L1.setOpaque(false);
R1L1.repaint();
Community
  • 1
  • 1
eandr127
  • 35
  • 5
  • FYI: In that case, you should either make a comment directing the OP to the duplicate question or when you reputation is high enough, vote to close the question, as neither the answer or the question is adding any additional value to the site – MadProgrammer Jun 12 '14 at 00:10