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


Java AbstractButton.setToolTipText方法代碼示例

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


在下文中一共展示了AbstractButton.setToolTipText方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: updateTooltip

import javax.swing.AbstractButton; //導入方法依賴的package包/類
private static void updateTooltip(AbstractButton b, List<? extends MultiKeyBinding> keybindings) {
    Action a = b.getAction();
    String actionName = a == null ? null : (String) a.getValue(Action.NAME);
    
    if (actionName == null) {
        // perhaps no action at all
        return;
    }
    
    for (MultiKeyBinding mkb : keybindings) {
        if (actionName.equals(mkb.getActionName())) {
            b.setToolTipText(b.getToolTipText() + " (" + // NOI18N
                    EditorActionUtilities.getKeyMnemonic(mkb) + ")"); // NOI18N
            break; // multiple shortcuts ?
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:NbEditorToolBar.java

示例3: updateButton

import javax.swing.AbstractButton; //導入方法依賴的package包/類
/** Updates the state of those pushbuttons in the left
 * vertical tool box that need to indicate the special "ambiguous"
 * state marking that some of the currently selected components
 * have the respective property set while some do not.
 */
private void updateButton(AbstractButton button, boolean nonEmptySelection, boolean allSelectedUnambiguous, String iconWarning, String toolTipWarning, String iconNormal, String toolTipNormal) {
    button.setSelected(allSelectedUnambiguous);
    if(nonEmptySelection && !allSelectedUnambiguous) {
        button.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/form/layoutsupport/griddesigner/resources/" + iconWarning, false)); // NOI18N
        button.setToolTipText(NbBundle.getMessage(GridBagCustomizer.class, "GridBagCustomizer." + toolTipWarning)); // NOI18N
    } else {
        button.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/form/layoutsupport/griddesigner/resources/" + iconNormal, false)); // NOI18N
        button.setToolTipText(NbBundle.getMessage(GridBagCustomizer.class, "GridBagCustomizer." + toolTipNormal)); // NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:GridBagCustomizer.java

示例4: mnemonicAndToolTip

import javax.swing.AbstractButton; //導入方法依賴的package包/類
private static void mnemonicAndToolTip(AbstractButton button, String toolTip) {
    String text = button.getText();

    if (text == null) {
        Mnemonics.setLocalizedText(button, toolTip);
        button.setText(null);
    }
    else {
        Mnemonics.setLocalizedText(button, text);
        button.setText(cutMnemonicAndAmpersand(text));
    }
    button.setToolTipText(cutMnemonicAndAmpersand(toolTip));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:UI.java


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