当前位置: 首页>>代码示例>>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;未经允许,请勿转载。