* @return Icon or null if there is no icon for the button.
*/
public static Icon getCurrentIcon(final AbstractButton button) {
Icon icon = null;
final ButtonModel model = button.getModel();
if (model.isEnabled()) {
if (model.isArmed()) {
icon = button.getPressedIcon();
} else if (model.isRollover()){
icon = model.isSelected() ? button.getRolloverSelectedIcon()
: button.getRolloverIcon();
} else if (model.isSelected()) {
icon = button.getSelectedIcon();
}
} else {
icon = model.isSelected() ? button.getDisabledSelectedIcon()
: button.getDisabledIcon();
}
if (icon == null) {
icon = button.getIcon();
}