this.rolloverSelectedIcon = rolloverSelectedIcon;
firePropertyChange(ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, oldValue, rolloverSelectedIcon);
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
oldValue, rolloverSelectedIcon);
}
setRolloverEnabled(true);
if (rolloverSelectedIcon != oldValue) {
// No way to determine whether we are currently in
// a rollover state, so repaint regardless
if (isSelected()) {
repaint();
}
}
}
/**
* Returns the icon used by the button when it's disabled.
* If no disabled icon has been set this will forward the call to
* the look and feel to construct an appropriate disabled Icon.
* <p>
* Some look and feels might not render the disabled Icon, in which
* case they will ignore this.
*
* @return the <code>disabledIcon</code> property
* @see #getPressedIcon
* @see #setDisabledIcon
* @see javax.swing.LookAndFeel#getDisabledIcon
*/
public Icon getDisabledIcon() {
if (disabledIcon == null) {
disabledIcon = UIManager.getLookAndFeel().getDisabledIcon(this, getIcon());
if (disabledIcon != null) {
firePropertyChange(DISABLED_ICON_CHANGED_PROPERTY, null, disabledIcon);
}
}
return disabledIcon;
}
/**
* Sets the disabled icon for the button.
* @param disabledIcon the icon used as the disabled image
* @see #getDisabledIcon
* @beaninfo
* bound: true
* attribute: visualUpdate true
* description: The disabled icon for the button.
*/
public void setDisabledIcon(Icon disabledIcon) {
Icon oldValue = this.disabledIcon;
this.disabledIcon = disabledIcon;
firePropertyChange(DISABLED_ICON_CHANGED_PROPERTY, oldValue, disabledIcon);
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
oldValue, disabledIcon);
}
if (disabledIcon != oldValue) {
if (!isEnabled()) {
repaint();
}
}
}
/**
* Returns the icon used by the button when it's disabled and selected.
* If no disabled selection icon has been set, this will forward
* the call to the LookAndFeel to construct an appropriate disabled
* Icon from the selection icon if it has been set and to
* <code>getDisabledIcon()</code> otherwise.
* <p>
* Some look and feels might not render the disabled selected Icon, in
* which case they will ignore this.
*
* @return the <code>disabledSelectedIcon</code> property
* @see #getDisabledIcon
* @see #setDisabledSelectedIcon
* @see javax.swing.LookAndFeel#getDisabledSelectedIcon
*/
public Icon getDisabledSelectedIcon() {
if (disabledSelectedIcon == null) {
if (selectedIcon != null) {
disabledSelectedIcon = UIManager.getLookAndFeel().
getDisabledSelectedIcon(this, getSelectedIcon());
} else {
return getDisabledIcon();
}
}
return disabledSelectedIcon;
}
/**
* Sets the disabled selection icon for the button.
* @param disabledSelectedIcon the icon used as the disabled
* selection image
* @see #getDisabledSelectedIcon
* @beaninfo
* bound: true
* attribute: visualUpdate true
=7= |