本文整理匯總了Java中javax.swing.AbstractButton.setRolloverSelectedIcon方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractButton.setRolloverSelectedIcon方法的具體用法?Java AbstractButton.setRolloverSelectedIcon怎麽用?Java AbstractButton.setRolloverSelectedIcon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.AbstractButton
的用法示例。
在下文中一共展示了AbstractButton.setRolloverSelectedIcon方法的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);
}
}