當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractButton.setPressedIcon方法代碼示例

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


在下文中一共展示了AbstractButton.setPressedIcon方法的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);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:44,代碼來源:EditorActionUtilities.java

示例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);
	}
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:14,代碼來源:Tools.java


注:本文中的javax.swing.AbstractButton.setPressedIcon方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。