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);
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…