@Override public JMenuItem add(JMenuItem menuItem) { Component c = target.add(menuItem); if ( c instanceof JMenu ) { ((JMenu)c).setIcon(null); } return menuItem; }
@Override public JMenuItem add(JMenuItem menuItem) { Component c = target.add(menuItem); if ( c instanceof JMenu ) { ((JMenu)c).setIcon(null); } return menuItem; }
JMenu mFoo = new JMenu("Foo"); mFoo.setIcon(new ImageIcon("icon.png")); JMenuBar menuBar = new JMenuBar(); menuBar.add(mFoo); setJMenuBar(menuBar);
@Override public IPopupMenuActionsBuilder addSubPopupMenu(Icon icon, String name) { JMenu menu = new JMenu(name); menu.setIcon(icon); menu.add(menu); return new SubPopupMenuActionsBuilder(menu); } }
private JMenu[] getAutomaticMarkersMenu() { // AutomaticMarker[] markers = MarkersContainer.getInstance().getMarkers().toArray(new AutomaticMarker[0]); automaticMarkersMenu = new JMenu("Mark rows automatically"); automaticMarkersMenu.setIcon(Icons.AUTOMATIC_MARKERS); automaticUnmarkersMenu = new JMenu("Unmark rows automatically"); automaticUnmarkersMenu.setIcon(Icons.AUTOMATIC_UNMARKERS); updateMarkerMenu(markersContainer.getElements()); return new JMenu[]{automaticMarkersMenu, automaticUnmarkersMenu}; }
@Override public IPopupMenuActionsBuilder addSubPopupMenu(Icon icon, String name) { JMenu menu = new JMenu(name); menu.setIcon(icon); popupMenu.add(menu); return new SubPopupMenuActionsBuilder(menu); }
private void createJMenu() { log.trace("Creating new JMenu with name: " + menuName); menu = new JMenu(menuName); if (icon != null) { log.trace("Setting menu icon to " + icon); menu.setIcon(icon); } menu.add(new ClearAction(messages)); menu.add(new JSeparator(JSeparator.HORIZONTAL)); }
private void createJMenu(final String menuName, final Icon icon, final String clearName, final String clearTooltip) { log.trace("Creating new JMenu with name: " + menuName); this.menu = new JMenu(menuName); if (icon != null) { log.trace("Setting menu icon to " + icon); this.menu.setIcon(icon); } if (clearName != null) { this.menu.add(new ClearAction(clearName, clearTooltip)); this.menu.add(new JSeparator(JSeparator.HORIZONTAL)); } }
protected void setSubMenuIcon(String name, ImageIcon icon) { getSubmenu(name, -1).setIcon(icon); }
private void markCheckedMenu(boolean marked) { if (marked) { JCheckBoxMenuItem it = new JCheckBoxMenuItem(); it.setSelected(true); /* * This is unfortunate. We cannot easily get the checkbox * icon from the L&F. Actually we get it, and then it * throws a class cast exception when it tries to paint it, * because it expects the component to be a JCheckBox. */ menu.setIcon(Icons.getIcon("hierarchy.collapsed.gif")); } else { menu.setIcon(null); } }
private void markCheckedMenu(boolean marked) { if (marked) { JCheckBoxMenuItem it = new JCheckBoxMenuItem(); it.setSelected(true); /* * This is unfortunate. We cannot easily get the checkbox * icon from the L&F. Actually we get it, and then it * throws a class cast exception when it tries to paint it, * because it expects the component to be a JCheckBox. */ menu.setIcon(Icons.getIcon("hierarchy.collapsed.gif")); } else { menu.setIcon(null); } }
private void markCheckedMenu(boolean marked) { if (marked) { JCheckBoxMenuItem it = new JCheckBoxMenuItem(); it.setSelected(true); /* * This is unfortunate. We cannot easily get the checkbox * icon from the L&F. Actually we get it, and then it * throws a class cast exception when it tries to paint it, * because it expects the component to be a JCheckBox. */ menu.setIcon(Icons.getIcon("hierarchy.collapsed.gif")); } else { menu.setIcon(null); } }
private void markCheckedMenu(boolean marked) { if (marked) { JCheckBoxMenuItem it = new JCheckBoxMenuItem(); it.setSelected(true); /* * This is unfortunate. We cannot easily get the checkbox * icon from the L&F. Actually we get it, and then it * throws a class cast exception when it tries to paint it, * because it expects the component to be a JCheckBox. */ menu.setIcon(Icons.getIcon("hierarchy.collapsed.gif")); } else { menu.setIcon(null); } }
/** * This method initializes importMenu. * @return javax.swing.JMenu */ private JMenu getImportMenu() { if (importMenu == null) { importMenu = new JMenu(); importMenu.setIcon(new ImageIcon(MainFrame.class.getResource("/icons/import-menu.png"))); //$NON-NLS-1$ importMenu.setText(textBundle.textFor("MainFrame.ImportMenu.Title")); //$NON-NLS-1$ importMenu.setMnemonic(textBundle.textFor("MainFrame.ImportMenu.Title").charAt(0)); //$NON-NLS-1$ importMenu.add(getImportItem()); } return importMenu; }
private void addPerspectiveToVisibilityMenu(final PerspectiveSPI perspective) { JMenu perspectivemenu = new JMenu(perspective.getText() + " perspective"); perspectivemenu.setIcon(perspective.getButtonIcon()); final JMenuItem toggle = new JMenuItem(); toggle.setAction(new HideShowAction(perspective.isVisible() ? "Hide" : "Show", perspective)); perspectivemenu.add(toggle); perspectives.get(perspective).setVisible(perspective.isVisible()); perspectiveVisibilityMenu.add(perspectivemenu); perspectiveVisibilityMap.put(perspective, perspectivemenu); }
/** * Start was called. This is the start-stuff that needs to be on the AWT * event queue. */ private void startOnEventQueue() { JMenu keyStoreMenu = new JMenu(messages.getMessage("keystore.menu")); keyStoreMenu.add(new LoadKeyStoreAction(workbench, this, messages)); loadedKeyStoreMenu = new JMenu(messages .getMessage("keystore.load.loaded")); loadedKeyStoreMenu.setEnabled(false); loadedKeyStoreMenu.setIcon(Utils.getIconFromMessages(messages, "keystore.load.loaded.icon")); keyStoreMenu.add(loadedKeyStoreMenu); workbench.getMenuBar().addMenu(KEYSTORE_MENU_KEY, keyStoreMenu); }
protected JMenu createOpenRecentFileMenu(@Nullable View view) { JMenuItem mi; JMenu m; m = new JMenu(); labels.configureMenu(m, // (getAction(view, LoadFileAction.ID) != null || // getAction(view, LoadDirectoryAction.ID) != null) ?// "file.loadRecent" :// "file.openRecent"// ); m.setIcon(null); m.add(getAction(view, ClearRecentFilesMenuAction.ID)); new OpenRecentMenuHandler(m, view); return m; }
public JMenuItem getMenuPresenter () { JMenu mainItem = new JMenuPlus(); Mnemonics.setLocalizedText(mainItem, getName()); mainItem.setIcon (SystemAction.get(ImportAction.class).getIcon()); HelpCtx.setHelpIDString (mainItem, ImportAction.class.getName()); mainItem.addMenuListener(new MainItemListener()); return mainItem; }
private JMenu getSubmenu( final IconGroup group) { final JMenu menu = new JMenu("\u25ba") { private static final long serialVersionUID = 1L; @Override protected Point getPopupMenuOrigin() { return new Point(getWidth(), 0); } }; menu.setFont(ARROW_FONT); menu.setMargin(ICON_SUBMENU_INSETS); menu.setIcon(group.getGroupIcon().getIcon()); for (final MindIcon icon : group.getIcons()) { addActionToIconSubmenu(menu, icon, icon.getFileName()); } menu.setToolTipText(group.getDescription()); return menu; }