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


Java AbstractButton.putClientProperty方法代碼示例

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


在下文中一共展示了AbstractButton.putClientProperty方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureToolbarButton

import javax.swing.AbstractButton; //導入方法依賴的package包/類
private void configureToolbarButton (AbstractButton item, String containerCtx, String action, ActionProvider provider, Map ctx) {
        item.setFocusable(false);
        item.setName(action);
        item.putClientProperty (KEY_ACTION, action);
        item.setToolTipText(
            provider.getDisplayName(action, containerCtx));
//        item.setToolTipText(provider.getDescription(action, containerCtx));
        int state = ctx == null ? ActionProvider.STATE_VISIBLE :
            provider.getState (action, containerCtx, ctx);
        boolean enabled = (state & ActionProvider.STATE_ENABLED) != 0;
        item.setEnabled(enabled);
        boolean visible = (state & ActionProvider.STATE_VISIBLE) != 0;
        item.setVisible (visible);
        boolean toggled = (state & ActionProvider.STATE_SELECTED) != 0;
        item.setSelected(toggled);
//        item.setMnemonic(provider.getMnemonic(action, containerCtx));
//        item.setDisplayedMnemonicIndex(provider.getMnemonicIndex(action, containerCtx));
        item.setIcon(provider.getIcon(action, containerCtx, BeanInfo.ICON_COLOR_16x16));
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:AbstractToolbarFactory.java

示例2: setMnemonic

import javax.swing.AbstractButton; //導入方法依賴的package包/類
/**
 * Wrapper for AbstractButton.setMnemonic and JLabel.setDisplayedMnemonic
 * @param item AbstractButton/JLabel
 * @param mnem Mnemonic char to set, latin [a-z,A-Z], digit [0-9], or any VK_ code
 */
private static void setMnemonic(Object item, int mnem) {
    if (isAquaLF()) {
        // there shall be no mnemonics on macosx.
        //#55864
        return;
    }

    if ((mnem >= 'a') && (mnem <= 'z')) {
        mnem = mnem + ('A' - 'a');
    }

    if (item instanceof AbstractButton) {
        AbstractButton b = (AbstractButton) item;
        b.putClientProperty(PROP_MNEMONIC, mnem);
        b.setMnemonic(mnem);
    } else {
        ((JLabel) item).setDisplayedMnemonic(mnem);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:Mnemonics.java

示例3: setMnemonicIndex

import javax.swing.AbstractButton; //導入方法依賴的package包/類
/**
 * Wrapper for the
 * <code>AbstractButton.setMnemonicIndex</code> or
 * <code>JLabel.setDisplayedMnemonicIndex</code> method.
 * @param item AbstractButton/JLabel or subclasses
 * @param index Index of the Character to underline under JDK1.4
 * @param latinCode Latin Character Keycode to underline under JDK1.3
 */
private static void setMnemonicIndex(Object item, int index) {
    if (item instanceof AbstractButton) {
        AbstractButton b = (AbstractButton) item;
        b.putClientProperty(PROP_DISPLAYED_MNEMONIC_INDEX, index);
        b.removePropertyChangeListener(PROP_DISPLAYED_MNEMONIC_INDEX, MNEMONIC_INDEX_LISTENER);
        b.setDisplayedMnemonicIndex(index);
        b.addPropertyChangeListener(PROP_DISPLAYED_MNEMONIC_INDEX, MNEMONIC_INDEX_LISTENER);
    } else if (item instanceof JLabel) {
        ((JLabel) item).setDisplayedMnemonicIndex(index);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:Mnemonics.java

示例4: setText

import javax.swing.AbstractButton; //導入方法依賴的package包/類
/**
 * Wrapper for AbstractButton/JLabel.setText
 * @param item AbstractButton/JLabel
 * @param text the text to set
 */
private static void setText(Object item, String text) {
    if (item instanceof AbstractButton) {
        AbstractButton b = (AbstractButton) item;
        b.putClientProperty(PROP_TEXT, text);
        b.setText(text);
    } else {
        ((JLabel) item).setText(text);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:Mnemonics.java

示例5: mouseEntered

import javax.swing.AbstractButton; //導入方法依賴的package包/類
public void mouseEntered(MouseEvent e) {
    AbstractButton b = (AbstractButton) e.getSource();
    b.putClientProperty(PROP_HOVERED, Boolean.TRUE);
    refresh(b);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:TransparentToolBar.java

示例6: mouseExited

import javax.swing.AbstractButton; //導入方法依賴的package包/類
public void mouseExited(MouseEvent e) {
    AbstractButton b = (AbstractButton) e.getSource();
    b.putClientProperty(PROP_HOVERED, Boolean.FALSE);
    refresh(b);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:TransparentToolBar.java


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