Set JLabel Disabled Icon - Java Swing

Java examples for Swing:JLabel

Description

Set JLabel Disabled Icon

Demo Code


import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JLabel;
 
public class Main {
       /*from  w  ww .  j  a v  a2  s .  com*/
        public void init(){
                JLabel label1 = new JLabel("JLabel Disabled Icon Example.");
                label1.setDisabledIcon(new ImageIcon("images/copy.gif"));
                Icon icon = label1.getDisabledIcon();
        }
}

Related Tutorials