Example usage for javax.swing JLabel setDisabledIcon

List of usage examples for javax.swing JLabel setDisabledIcon

Introduction

In this page you can find the example usage for javax.swing JLabel setDisabledIcon.

Prototype

@BeanProperty(visualUpdate = true, description = "The icon to display if the label is disabled.")
public void setDisabledIcon(Icon disabledIcon) 

Source Link

Document

Set the icon to be displayed if this JLabel is "disabled" (JLabel.setEnabled(false)).

Usage

From source file:IconInterfaceDemo.java

public static void main(String[] a) {
    JFrame mainFrame = new JFrame();

    JLabel label = new JLabel("label");

    label.setIcon(new ColoredSquare(Color.green));
    label.setDisabledIcon(new ColoredSquare(Color.red));

    mainFrame.getContentPane().add(label);

    mainFrame.setSize(100, 100);/*  w  w  w  . j  a  v  a2s . c om*/

    mainFrame.setVisible(true);

}