本文整理汇总了Java中javax.swing.AbstractButton.setDisabledSelectedIcon方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractButton.setDisabledSelectedIcon方法的具体用法?Java AbstractButton.setDisabledSelectedIcon怎么用?Java AbstractButton.setDisabledSelectedIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.AbstractButton
的用法示例。
在下文中一共展示了AbstractButton.setDisabledSelectedIcon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateButtonIcons
import javax.swing.AbstractButton; //导入方法依赖的package包/类
static void updateButtonIcons(AbstractButton button, Icon icon, boolean useLargeIcon, String iconResource) {
button.setIcon(icon);
if (iconResource != null) {
String base = iconResource;
String suffix = "";
int dotIndex;
if ((dotIndex = iconResource.lastIndexOf('.')) >= 0) {
suffix = iconResource.substring(dotIndex, iconResource.length());
base = iconResource.substring(0, dotIndex);
}
if (useLargeIcon) {
base += LARGE_ICON_SIZE_STRING;
}
Icon pressedIcon = ImageUtilities.loadImageIcon(base + "_pressed" + suffix, true); // NOI18N
if (pressedIcon != null) {
button.setPressedIcon(pressedIcon);
}
Icon rolloverIcon = ImageUtilities.loadImageIcon(base + "_rollover" + suffix, true); // NOI18N
if (rolloverIcon != null) {
button.setRolloverIcon(rolloverIcon);
}
Icon disabledIcon = ImageUtilities.loadImageIcon(base + "_disabled" + suffix, true); // NOI18N
if (disabledIcon != null) {
button.setDisabledIcon(disabledIcon);
} else { // Make disabled icon from regular icon
button.setDisabledIcon(ImageUtilities.createDisabledIcon(icon));
}
Icon selectedIcon = ImageUtilities.loadImageIcon(base + "_selected" + suffix, true); // NOI18N
if (selectedIcon != null) {
button.setSelectedIcon(selectedIcon);
}
Icon rolloverSelectedIcon = ImageUtilities.loadImageIcon(base + "_rolloverSelected" + suffix, true); // NOI18N
if (rolloverSelectedIcon != null) {
button.setRolloverSelectedIcon(rolloverSelectedIcon);
}
Icon disabledSelectedIcon = ImageUtilities.loadImageIcon(base + "_disabledSelected" + suffix, true); // NOI18N
if (disabledSelectedIcon != null) {
button.setDisabledSelectedIcon(disabledSelectedIcon);
}
}
}
示例2: setIcons
import javax.swing.AbstractButton; //导入方法依赖的package包/类
final public static void setIcons(AbstractButton objPabstractButton, Icon objPicon, Icon objProllOverIcon, Icon objPdisabledIcon) {
final Icon objLicon = objPicon != null ? objPicon : objProllOverIcon;
final Icon objLrollOverIcon = objProllOverIcon != null ? objProllOverIcon : objPicon;
objPabstractButton.setIcon(objLicon);
objPabstractButton.setSelectedIcon(objLicon);
objPabstractButton.setPressedIcon(objLrollOverIcon);
objPabstractButton.setRolloverIcon(objLrollOverIcon);
objPabstractButton.setRolloverSelectedIcon(objLrollOverIcon);
if (objPdisabledIcon != null) {
objPabstractButton.setDisabledIcon(objPdisabledIcon);
objPabstractButton.setDisabledSelectedIcon(objPdisabledIcon);
}
}