Java Code Examples for javax.swing.JMenuItem#setToolTipText()
The following examples show how to use
javax.swing.JMenuItem#setToolTipText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComponentSource.java From LoboBrowser with MIT License | 6 votes |
public void populateForwardMore() { final List<NavigationEntry> entries = this.window.getForwardNavigationEntries(); final JMenu forwardMoreMenu = this.forwardMoreMenu; forwardMoreMenu.removeAll(); for (final NavigationEntry entry : entries) { final String method = entry.getMethod(); if ("GET".equals(method)) { final String title = entry.getTitle(); final URL url = entry.getUrl(); final String text = (title == null) || (title.length() == 0) ? url.toExternalForm() : title; final Action action = this.actionPool.createGoToAction(entry); final JMenuItem menuItem = menuItem(text, action); menuItem.setToolTipText(url.toExternalForm()); forwardMoreMenu.add(menuItem); } } }
Example 2
Source File: AbstractFocusedTopicPlugin.java From netbeans-mmd-plugin with Apache License 2.0 | 6 votes |
@Override @Nullable public JMenuItem makeMenuItem( @Nonnull final PluginContext context, @Nullable final Topic activeTopic) { final JMenuItem result = UI_COMPO_FACTORY.makeMenuItem(getName(context, activeTopic), getIcon(context, activeTopic)); result.setToolTipText(getReference()); result.addActionListener(new ActionListener() { @Override public void actionPerformed(@Nonnull final ActionEvent e) { if (AbstractFocusedTopicPlugin.this instanceof ExternallyExecutedPlugin) { context.processPluginActivation((ExternallyExecutedPlugin) AbstractFocusedTopicPlugin.this, activeTopic); } else { doActionForTopic(context, activeTopic); } } }); return result; }
Example 3
Source File: ShapeSet.java From libreveris with GNU Lesser General Public License v3.0 | 6 votes |
/** * Populate the given menu with a list of all shapes that belong * to the given ShapeSet. * * @param set the set for which shape menu items must be buit * @param top the JComponent to populate (typically a JMenu or a * JPopupMenu) * @param listener the listener for notification of user selection */ public static void addSetShapes (ShapeSet set, JComponent top, ActionListener listener) { // All shapes in the given range for (Shape shape : set.getSortedShapes()) { JMenuItem menuItem = new JMenuItem( shape.toString(), shape.getDecoratedSymbol()); addColoredItem(top, menuItem, shape.getColor()); menuItem.setToolTipText(shape.getDescription()); menuItem.addActionListener(listener); } }
Example 4
Source File: EmoticonPopUpMenuPlugin.java From netbeans-mmd-plugin with Apache License 2.0 | 5 votes |
@Override @Nullable public JMenuItem makeMenuItem(@Nonnull final PluginContext context, @Nullable final Topic activeTopic) { final JMenuItem result = UI_COMPO_FACTORY.makeMenuItem(BUNDLE.getString("Emoticons.MenuTitle"), ICON); result.setToolTipText(BUNDLE.getString("Emoticons.MenuTooltip")); result.addActionListener(new ActionListener() { @Override public void actionPerformed(@Nonnull final ActionEvent e) { final IconPanel iconPanel = new IconPanel(); final JScrollPane scrollPane = UI_COMPO_FACTORY.makeScrollPane(); scrollPane.getVerticalScrollBar().setUnitIncrement(32); scrollPane.getVerticalScrollBar().setBlockIncrement(96); scrollPane.setPreferredSize(new Dimension(512, 400)); scrollPane.setViewportView(iconPanel); if (context.getDialogProvider().msgOkCancel(null, BUNDLE.getString("Emoticons.DialogTitle"), scrollPane)) { final String emoticonName = iconPanel.getSelectedName(); if (emoticonName != null) { final boolean changed; if ("empty".equals(emoticonName)) { changed = setAttribute(null, context, activeTopic); } else { changed = setAttribute(emoticonName, context, activeTopic); } if (changed) { context.getPanel().doNotifyModelChanged(true); } } } } }); return result; }
Example 5
Source File: PCGenMenuBar.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected JMenuItem createMenuItem(File item, int index) { JMenuItem menuItem = new JMenuItem(); menuItem.setText((index + 1) + " " + item.getName()); //$NON-NLS-1$ menuItem.setToolTipText(item.getAbsolutePath()); menuItem.setActionCommand(item.getAbsolutePath()); menuItem.setMnemonic(String.valueOf(index + 1).charAt(0)); menuItem.addActionListener(this); return menuItem; }
Example 6
Source File: PCGenMenuBar.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected JMenuItem createMenuItem(File item, int index) { JMenuItem menuItem = new JMenuItem(); menuItem.setText((index + 1) + " " + item.getName()); //$NON-NLS-1$ menuItem.setToolTipText( LanguageBundle.getFormattedString("in_OpenRecentCharTip", item.getAbsolutePath())); //$NON-NLS-1$ menuItem.setActionCommand(item.getAbsolutePath()); menuItem.setMnemonic(String.valueOf(index + 1).charAt(0)); menuItem.addActionListener(this); return menuItem; }
Example 7
Source File: ShapeSet.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
/** * Populate the given menu with a list of all shapes that belong * to the given ShapeSet. * * @param set the set for which shape menu items must be buit * @param top the JComponent to populate (typically a JMenu or a * JPopupMenu) * @param listener the listener for notification of user selection */ public static void addSetShapes (ShapeSet set, JComponent top, ActionListener listener) { // All shapes in the given range for (Shape shape : set.getSortedShapes()) { JMenuItem menuItem = new JMenuItem(shape.toString(), shape.getDecoratedSymbol()); addColoredItem(top, menuItem, shape.getColor()); menuItem.setToolTipText(shape.getDescription()); menuItem.addActionListener(listener); } }
Example 8
Source File: GuiMouseListener.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private void addShowCommunityActionMenu(JMenu menu) { JMenuItem showCommunityMenuItem = MenuFactory.createJMenuItem(communityOverviewAction, soundIdReader); showCommunityMenuItem.setText("Community Overview"); setMenuIcon(showCommunityMenuItem, ImageIds.BLACK_CROSS); showCommunityMenuItem.setToolTipText("show family members, acquaintances and organizations"); menu.add(showCommunityMenuItem); }
Example 9
Source File: MainFrame.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Creates the recent desc file item. * * @param num the num * @param file the file * @return the j menu item */ private final JMenuItem createRecentDescFileItem(int num, File file) { String fileShortName = file.getName(); JMenuItem item = new JMenuItem(num + " " + fileShortName, getMnemonic(num)); item.addActionListener(new LoadRecentDescFileEventHandler(this, file.getAbsolutePath())); item.setToolTipText(file.getAbsolutePath()); return item; }
Example 10
Source File: GuiMouseListener.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private void addCreateOrganizationMenu(JMenu menu) { JMenuItem createOrganizationMenuItem = MenuFactory.createJMenuItem(new GuiCreateOrganizationAction(playerCharacter, imageInfoReader, soundIdReader, world, (WorldPanel)container, dungeonMaster, parentFrame), soundIdReader); createOrganizationMenuItem.setText("Create Organization..."); setMenuIcon(createOrganizationMenuItem, Actions.CREATE_PROFESSION_ORGANIZATION_ACTION.getImageIds(playerCharacter)); createOrganizationMenuItem.setToolTipText("create an organization based on a deity or profession"); menu.add(createOrganizationMenuItem); }
Example 11
Source File: GuiMouseListener.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private void addAssignActionsToLeftMouse(JPopupMenu menu) { JMenuItem guiAssignActionsToLeftMouseItem = MenuFactory.createJMenuItem(assignActionToLeftMouseAction, soundIdReader); guiAssignActionsToLeftMouseItem.setText("Assign action to left mouse click..."); guiAssignActionsToLeftMouseItem.setIcon(IconUtils.getMouseIcon()); guiAssignActionsToLeftMouseItem.setToolTipText("Assigns an action to the left mouse button"); menu.add(guiAssignActionsToLeftMouseItem); }
Example 12
Source File: ComponentSource.java From LoboBrowser with MIT License | 5 votes |
public void populateRecentBookmarks() { final JMenu bookmarksMenu = this.recentBookmarksMenu; bookmarksMenu.removeAll(); final Collection<HistoryEntry<BookmarkInfo>> historyEntries = BookmarksHistory.getInstance().getRecentEntries(PREFERRED_MAX_MENU_SIZE); for (final HistoryEntry<BookmarkInfo> hentry : historyEntries) { final BookmarkInfo binfo = hentry.getItemInfo(); String text = binfo.getTitle(); final URL url = binfo.getUrl(); final String urlText = url.toExternalForm(); if ((text == null) || (text.length() == 0)) { text = urlText; } final long elapsed = System.currentTimeMillis() - hentry.getTimetstamp(); text = text + " (" + Timing.getElapsedText(elapsed) + " ago)"; final Action action = this.actionPool.createBookmarkNavigateAction(url); final JMenuItem menuItem = ComponentSource.menuItem(text, action); final StringBuffer toolTipText = new StringBuffer(); toolTipText.append("<html>"); toolTipText.append(urlText); final String description = binfo.getDescription(); if ((description != null) && (description.length() != 0)) { toolTipText.append("<br>"); toolTipText.append(description); } menuItem.setToolTipText(toolTipText.toString()); bookmarksMenu.add(menuItem); } }
Example 13
Source File: MainFrame.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Creates the recent text file item. * * @param num the num * @param file the file * @return the j menu item */ private final JMenuItem createRecentTextFileItem(int num, File file) { String fileShortName = file.getName(); JMenuItem item = new JMenuItem(num + " " + fileShortName, getMnemonic(num)); item.addActionListener(new LoadRecentTextFileEventHandler(this, file.getAbsolutePath())); item.setToolTipText(file.getAbsolutePath()); return item; }
Example 14
Source File: InventoryDialog.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private void addPlayerCharacterMenuActions(JPopupMenu popupMenu, InventoryItem inventoryItem, InventoryDialogModel inventoryDialogModel, InventoryActionFactory inventoryActionFactory) { for(Action inventoryDialogAction : inventoryActionFactory.getPlayerCharacterInventoryActions(inventoryItem.getId())) { JMenuItem actionMenuItem = MenuFactory.createJMenuItem(inventoryDialogAction, soundIdReader); actionMenuItem.setToolTipText((String) inventoryDialogAction.getValue(Action.LONG_DESCRIPTION)); popupMenu.add(actionMenuItem); } }
Example 15
Source File: GuiMouseListener.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private void addRestMenu(JPopupMenu menu) { JMenuItem restMenuItem = MenuFactory.createJMenuItem(restAction, soundIdReader); setMenuIcon(restMenuItem, ImageIds.SLEEPING_INDICATOR); restMenuItem.setText("Rest..."); restMenuItem.setToolTipText(Actions.REST_ACTION.getDescription()); menu.add(restMenuItem); }
Example 16
Source File: GuiMenu.java From FancyBing with GNU General Public License v3.0 | 5 votes |
public JMenuItem add(JMenuItem item) { super.add(item); item.setToolTipText(null); item.setIcon(null); int mnemonic = item.getMnemonic(); if (mnemonic > 0) { if (m_mnemonics.contains(mnemonic)) System.err.println("Warning: duplicate mnemonic item: " + item.getText()); m_mnemonics.add(mnemonic); } return item; }
Example 17
Source File: StartScreen.java From WorldGrower with GNU General Public License v3.0 | 4 votes |
private JMenuItem createMenuItem(Action action, ImageIcon imageIcon, String toolTipText) { JMenuItem menuItem = MenuFactory.createJMenuItem(action, soundIdReader); menuItem.setIcon(imageIcon); menuItem.setToolTipText(toolTipText); return menuItem; }
Example 18
Source File: RecentItems.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 4 votes |
private JMenuItem getMenu(RecentItem recentItem) { JMenuItem menuItem = new JMenuItem(recentItem.getProjectName()); menuItem.addActionListener(this); menuItem.setToolTipText(recentItem.getLocation()); return menuItem; }
Example 19
Source File: XAction.java From scelight with Apache License 2.0 | 4 votes |
@Override public JMenuItem addToMenu( final JMenu menu ) { // XMenu is not part of the launcher... final JMenuItem mi = menu.add( this ); mi.setToolTipText( null ); // We don't want tool tip on menu items... return mi; }
Example 20
Source File: ProjectMRUMenu.java From ganttproject with GNU General Public License v3.0 | 4 votes |
@Override public JMenuItem add(Action a) { JMenuItem result = super.add(a); result.setToolTipText(null); return result; }