本文整理了Java中javax.swing.JMenuItem.setToolTipText()
方法的一些代码示例,展示了JMenuItem.setToolTipText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuItem.setToolTipText()
方法的具体详情如下:
包路径:javax.swing.JMenuItem
类名称:JMenuItem
方法名:setToolTipText
暂无
代码示例来源:origin: stanfordnlp/CoreNLP
loadDataItem.setMnemonic('o');
loadDataItem.setText("Load File");
loadDataItem.setToolTipText("Load a data file.");
loadDataItem.addActionListener(this::loadDataItemActionPerformed);
exitItem.setMnemonic('x');
exitItem.setText("Exit");
exitItem.setToolTipText("Exits the program.");
exitItem.addActionListener(this::exitItemActionPerformed);
代码示例来源:origin: wiztools/rest-client
@Override
public void menuSelected(MenuEvent me) {
List<File> recentFiles = recentFilesHelper.getRecentFiles();
jm_open_recent.removeAll();
for(final File f: recentFiles) {
JMenuItem jmi = new JMenuItem(f.getName());
jmi.setToolTipText(f.getAbsolutePath());
jmi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
FileOpenUtil.open(view, f);
}
});
jm_open_recent.add(jmi);
}
// Add clear option:
if(!recentFilesHelper.isEmpty()) {
jm_open_recent.addSeparator();
JMenuItem jmi = new JMenuItem("Clear");
jmi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
recentFilesHelper.clear();
}
});
jm_open_recent.add(jmi);
}
}
代码示例来源:origin: magefree/mage
menuItem.setActionCommand(CMD_AUTO_ANSWER_ID_YES);
menuItem.addActionListener(actionListener);
menuItem.setToolTipText("<HTML>If the same question from the same ability would<br/>be asked again, it's automatically answered with <b>Yes</b>.");
popupMenuAskYes.add(menuItem);
menuItem.setToolTipText("<HTML>If the same question from the same ability would<br/>be asked again, it's automatically answered with <b>No</b>.");
menuItem.addActionListener(actionListener);
popupMenuAskNo.add(menuItem);
menuItem.setToolTipText("<HTML>If the same question would be asked again (regardless from which source),<br/> it's automatically answered with <b>Yes</b>.");
menuItem.addActionListener(actionListener);
popupMenuAskYes.add(menuItem);
menuItem.setToolTipText("<HTML>If the same question would be asked again (regardless from which source),<br/> it's automatically answered with <b>No</b>.");
menuItem.addActionListener(actionListener);
popupMenuAskNo.add(menuItem);
代码示例来源:origin: magefree/mage
menuItem = new JMenuItem("<html><b>F4</b> - Phases until next turn");
menuItem.setActionCommand("F4");
menuItem.setToolTipText(tooltipText);
menuItem.setMnemonic(KeyEvent.VK_T);
skipMenu.add(menuItem);
menuItem.setToolTipText(tooltipText);
menuItem.setMnemonic(KeyEvent.VK_E);
skipMenu.add(menuItem);
menuItem.setToolTipText(everythingTooltipText);
menuItem.setMnemonic(KeyEvent.VK_U);
skipMenu.add(menuItem);
menuItem.setToolTipText(tooltipText);
menuItem.setActionCommand("F7");
menuItem.setMnemonic(KeyEvent.VK_M);
menuItem.setToolTipText(everythingTooltipText);
menuItem.setMnemonic(KeyEvent.VK_V);
skipMenu.add(menuItem);
menuItem.setToolTipText(everythingTooltipText);
menuItem.setMnemonic(KeyEvent.VK_P);
skipMenu.add(menuItem);
menuItem.setToolTipText("Reset all effects that were added to the list of auto select replacement effects this game.");
automaticConfirmsMenu.add(menuItem);
代码示例来源:origin: com.fifesoft.rtext/fife.common
/**
* Returns a menu item configured to use an action.
*
* @param action The action.
* @return The menu item.
* @see #newMenuItem(ResourceBundle, String, Action)
*/
public static JMenuItem newMenuItem(Action action) {
JMenuItem menuItem = new JMenuItem(action);
menuItem.setToolTipText(null); // Clear SHORT_DESC being set to tool tip
return menuItem;
}
代码示例来源:origin: igvteam/igv
public void notifyGenomeServerReachable(boolean reachable) {
if (loadFromServerMenuItem != null) {
UIUtilities.invokeOnEventThread(() -> {
loadFromServerMenuItem.setEnabled(reachable);
String tooltip = reachable ? LOAD_GENOME_SERVER_TOOLTIP : CANNOT_LOAD_GENOME_SERVER_TOOLTIP;
loadFromServerMenuItem.setToolTipText(tooltip);
});
}
}
代码示例来源:origin: com.fifesoft.rtext/fife.common
private static void configureMenuItem(JMenuItem item, String desc) {
// Since these menu items are often configured with Actions, we must
// explicitly set the tool tip text to null
item.setToolTipText(null);
item.getAccessibleContext().setAccessibleDescription(desc);
}
代码示例来源:origin: uk.org.mygrid.taverna/taverna-workbench
private JMenuItem makeSwitchProfileMenu() {
JMenuItem revertMenu = new JMenuItem();
revertMenu.setAction(new AbstractAction("Switch version") {
public void actionPerformed(ActionEvent e) {
ProfileVersionListFrame frame=new ProfileVersionListFrame(Workbench.this);
frame.setLocationRelativeTo(Workbench.this);
frame.setVisible(true);
}
});
revertMenu.setToolTipText("Switch to another core Taverna version");
return revertMenu;
}
代码示例来源:origin: igvteam/igv
static public JMenuItem createMenuItem(MenuAction menuItemAction) {
JMenuItem menuItem = new JMenuItem();
menuItem.setAction(menuItemAction);
String text = menuItemAction.getToolTipText();
if (text != null) {
menuItem.setToolTipText(text);
}
return menuItem;
}
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
public void setDescription(String description) {
this.description = description;
getMenuItem().setToolTipText(getDescription());
}
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-config
protected void createCopyCellValue() {
$objectMap.put("copyCellValue", copyCellValue = new JMenuItem());
copyCellValue.setName("copyCellValue");
copyCellValue.setText(t("config.action.copyCellValue"));
copyCellValue.setToolTipText(t("config.action.copyCellValue.tip"));
copyCellValue.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__copyCellValue"));
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets-config
protected void createCopyCellValue() {
$objectMap.put("copyCellValue", copyCellValue = new JMenuItem());
copyCellValue.setName("copyCellValue");
copyCellValue.setText(t("config.action.copyCellValue"));
copyCellValue.setToolTipText(t("config.action.copyCellValue.tip"));
copyCellValue.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__copyCellValue"));
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets-config
protected void createResetOptionValue() {
$objectMap.put("resetOptionValue", resetOptionValue = new JMenuItem());
resetOptionValue.setName("resetOptionValue");
resetOptionValue.setText(t("config.action.resetOptionValue"));
resetOptionValue.setToolTipText(t("config.action.resetOptionValue.tip"));
resetOptionValue.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__resetOptionValue"));
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-config
protected void createResetOptionValue() {
$objectMap.put("resetOptionValue", resetOptionValue = new JMenuItem());
resetOptionValue.setName("resetOptionValue");
resetOptionValue.setText(t("config.action.resetOptionValue"));
resetOptionValue.setToolTipText(t("config.action.resetOptionValue.tip"));
resetOptionValue.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__resetOptionValue"));
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-config
protected void createResetOptionValue() {
$objectMap.put("resetOptionValue", resetOptionValue = new JMenuItem());
resetOptionValue.setName("resetOptionValue");
resetOptionValue.setText(t("config.action.resetOptionValue"));
resetOptionValue.setToolTipText(t("config.action.resetOptionValue.tip"));
resetOptionValue.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__resetOptionValue"));
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets
protected void createSelectedListMoveDownAction() {
$objectMap.put("selectedListMoveDownAction", selectedListMoveDownAction = new JMenuItem());
selectedListMoveDownAction.setName("selectedListMoveDownAction");
selectedListMoveDownAction.setText(t("bean.action.selected.move.down"));
selectedListMoveDownAction.setToolTipText(t("bean.action.selected.move.down.tip"));
selectedListMoveDownAction.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__selectedListMoveDownAction"));
}
代码示例来源:origin: org.orbisgis/mapeditor
@Override
public void feedPopupMenu(JPopupMenu menu) {
if(downloaded.get()) {
JMenuItem updateMenu = new JMenuItem(I18N.tr("Update"),
MapEditorIcons.getIcon("refresh"));
updateMenu.setToolTipText(I18N.tr("Download the workspace content"));
updateMenu.setActionCommand("Update");
updateMenu.addActionListener(
EventHandler.create(ActionListener.class,this,"update"));
MenuCommonFunctions.updateOrInsertMenuItem(menu, updateMenu);
}
}
代码示例来源:origin: com.fifesoft.rtext/fife.common
private void addSwatch(Color color, GridBagLayout gridbag,
GridBagConstraints c) {
// We want a menu item that uses a custom UI even when the
// user changes it.
JMenuItem item = new JMenuItem(new ColorIcon(color, 16,16));
item.setToolTipText(createToolTipText(color));
item.setUI(new SwatchMenuItemUI());
item.addActionListener(popupListener);
gridbag.setConstraints(item, c);
add(item);
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
private JMenu createLaFMenu() {
JMenu lafMenu = makeMenuRes("appearance", 'L');
for (LookAndFeelInfo laf : getAllLAFs()) {
JMenuItem menuItem = new JMenuItem(laf.getName());
menuItem.addActionListener(ActionRouter.getInstance());
menuItem.setActionCommand(ActionNames.LAF_PREFIX + laf.getClassName());
menuItem.setToolTipText(laf.getClassName()); // show the classname to the user
lafMenu.add(menuItem);
}
return lafMenu;
}
代码示例来源:origin: org.orbisgis/mapeditor
@Override
public void feedPopupMenu(JPopupMenu menu) {
JMenuItem addServer = new JMenuItem(I18N.tr("Add Map Catalog server"),
MapEditorIcons.getIcon("world_add"));
addServer.setToolTipText(I18N.tr("Add a new remote map catalog"));
addServer.setActionCommand("TreeNodeRemoteRoot:addServer");
addServer.addActionListener(
EventHandler.create(ActionListener.class,
this, "onAddServer"));
MenuCommonFunctions.updateOrInsertMenuItem(menu, addServer);
}
内容来源于网络,如有侵权,请联系作者删除!