Adding a Disabled Icon to a JButton Component

By default, when a button is disabled, it automatically generates a grayed-out version of the installed icon. However, it is possible to set a specific icon to use when the button is disabled.
// To create a button with an icon, see Adding an Icon to a JButton Component // Icon will appear gray button.setEnabled(false); // Set a disabled version of icon Icon disabledIcon = new ImageIcon("dicon.gif"); button.setDisabledIcon(disabledIcon); // To remove the disabled version of the icon, set to null button.setDisabledIcon(null); // If original icon is set as the disabled icon, disabling // the button will have no effect on the icon button.setDisabledIcon(icon);

Comments

12 Jan 2010 - 7:21am by güido (not verified)

Good examples!

Regards,
Guido .(from Uruguay)

3 Sep 2010 - 12:46am by tudor watches (not verified)

Quinn acknowledged Nike messenger bags Bren, who has other children Nike zoom flight 95 from other relationships, was not replica rolex watch a typical father figure for panerai replica Christine and David.

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.