Set Background Color of JLabel - Java Swing

Java examples for Swing:JLabel

Description

Set Background Color of JLabel

Demo Code


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);
        }
}

Related Tutorials