In my JPanel
, I set the background of a JLabel
to a different color. I can see the word "Test" and it's blue, but the background doesn't change at all. How can I get it to show?
this.setBackground(Color.white);
JLabel label = new JLabel("Test");
label.setForeground(Color.blue);
label.setBackground(Color.lightGray);
this.add(label);