Java examples for Swing:JLabel
Set Background Color of JLabel
import java.awt.Color; import javax.swing.JApplet; import javax.swing.JLabel; public class Main { //from w w w .j a v a 2s. c o m public void init(){ JLabel label1 = new JLabel("JLabel Set Background Color Example."); Color customColor = new Color(10,10,255); label1.setOpaque(true); label1.setBackground(customColor); } }