• Post Reply Bookmark Topic Watch Topic
  • New Topic

Colors on labels  RSS feed

 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a piece of text which I want to be in white on a blue background. I have a JLabel sitting on a JPanel but I haven't been able to adjust the color by using setBackground() and setForeground(). When I change background, the new color only shows up if I create a raised bevel frame. Can anyone tell me the simple way to do this?
Thanks.
Paul
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
Make the label background opaque and it should work.
label1.setOpaque( true );
Regards,
Manfred.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!