本文整理汇总了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));
}
示例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 ?
}
}
}
示例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
}
}
示例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));
}