private void refreshMenu() { if (menuItems != null && menuItems.length > 0) { firstIndex = Math.max(topFixedCount, firstIndex); firstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, firstIndex); upItem.setEnabled(firstIndex > topFixedCount); downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount); menu.removeAll(); for (int i = 0; i < topFixedCount; i++) { menu.add(menuItems[i]); } if (topFixedCount > 0) { menu.addSeparator(); } menu.add(upItem); for (int i = firstIndex; i < scrollCount + firstIndex; i++) { menu.add(menuItems[i]); } menu.add(downItem); if (bottomFixedCount > 0) { menu.addSeparator(); } for (int i = menuItems.length - bottomFixedCount; i < menuItems.length; i++) { menu.add(menuItems[i]); } JComponent parent = (JComponent) upItem.getParent(); parent.revalidate(); parent.repaint(); } }
public void createPopupMenu() { super.createPopupMenu(); JPopupMenu popupMenu = getPopupMenu(); if (popupMenu == null) { popupMenu = new JPopupMenu(); setPopupMenu(popupMenu); } else { popupMenu.addSeparator(); } propertiesItem = new JMenuItem("Properties ..."); propertiesItem.addActionListener(this); propertiesItem.setMnemonic('s'); popupMenu.add(propertiesItem); popupMenu.addSeparator(); ButtonGroup group = new ButtonGroup(); inItem = new JRadioButtonMenuItem("IN"); group.add(inItem); inItem.addActionListener(this); popupMenu.add(inItem); outItem = new JRadioButtonMenuItem("OUT"); group.add(outItem); outItem.addActionListener(this); popupMenu.add(outItem); inoutItem = new JRadioButtonMenuItem("INOUT"); group.add(inoutItem); inoutItem.addActionListener(this); popupMenu.add(inoutItem); }
private void addPopupMenu() { JPopupMenu menu = new JPopupMenu(); markItems = new JMenuItem[AlertsTableModel.status.length]; for (int i = 0; i < markItems.length; i++) { markItems[i] = menu.add("Mark as " + AlertsTableModel.status[i]); markItems[i].addActionListener(this); } menu.addSeparator(); moveToDetails = menu.add("View Related Flows for this Host"); menu.addSeparator(); deleteAlerts = menu.add("Delete"); deleteAlertsForHost = menu.add("Remove all Alerts for this Host"); deleteAlertTypeForHost = menu.add("Remove This Alert Type for this Host"); deleteAlerts.addActionListener(this); deleteAlertsForHost.addActionListener(this); deleteAlertTypeForHost.addActionListener(this); moveToDetails.addActionListener(this); table.setComponentPopupMenu(menu); }
private void setupPopupMenu() { _popup = new SkinPopupMenu(); _popup.add(new SkinMenuItem(refreshAction)); _popup.add(new SkinMenuItem(refreshID3TagsAction)); _popup.add(new SkinMenuItem(renameAction)); _popup.addSeparator(); _popup.add(new SkinMenuItem(deleteAction)); _popup.add(new SkinMenuItem(cleanupPlaylistAction)); _popup.addSeparator(); _popup.add(new SkinMenuItem(importToPlaylistAction)); _popup.add(new SkinMenuItem(importToNewPlaylistAction)); _popup.addSeparator(); _popup.add(new SkinMenuItem(copyPlaylistFilesAction)); _popup.add(new SkinMenuItem(exportPlaylistAction)); _popup.addSeparator(); if (OSUtils.isWindows() || OSUtils.isMacOSX()) { _popup.add(new SkinMenuItem(exportToiTunesAction)); } _popup.addSeparator(); _popup.add( new SkinMenuItem( new ConfigureOptionsAction( OptionsConstructor.LIBRARY_KEY, I18n.tr("Configure Options"), I18n.tr("You can configure the FrostWire\'s Options.")))); }
public ManagerPopupMenu() { jPopupMenu = new JPopupMenu(); Font font = new Font("Verdana", Font.PLAIN, 12); JMenuItem jFormProviderOrderItem = new JMenuItem("Отменить заказ"); jFormProviderOrderItem.setFont(font); jFormProviderOrderItem.addActionListener(e -> ClientWindow.this.cancelClientOrder()); jPopupMenu.add(jFormProviderOrderItem); jPopupMenu.addSeparator(); JMenuItem jPay25OrderItem = new JMenuItem("Оплатить часть заказа"); jPay25OrderItem.addActionListener( e -> ClientWindow.this.pay25Order( ((DefaultMutableTreeNode) e.getSource()).getUserObject().toString())); jPay25OrderItem.setFont(font); jPopupMenu.add(jPay25OrderItem); jPopupMenu.addSeparator(); JMenuItem jPayFullOrderItem = new JMenuItem("Оплатить весь заказ"); jPayFullOrderItem.addActionListener( e -> ClientWindow.this.payFullOrder( ((DefaultMutableTreeNode) e.getSource()).getUserObject().toString())); jPayFullOrderItem.setFont(font); jPopupMenu.add(jPayFullOrderItem); }
private JPopupMenu fillMenu(boolean under) { final JPopupMenu result = new JBPopupMenu(); if (under && myOptions.length > 0) { final JMenuItem mainAction = new JBMenuItem(getAction()); configureItem(getMenuInfo(getAction()), mainAction); result.add(mainAction); result.addSeparator(); } for (Action each : myOptions) { if (getAction() == each) continue; final OptionInfo info = getMenuInfo(each); final JMenuItem eachItem = new JBMenuItem(each); configureItem(info, eachItem); result.add(eachItem); } if (!under && myOptions.length > 0) { result.addSeparator(); final JMenuItem mainAction = new JBMenuItem(getAction()); configureItem(getMenuInfo(getAction()), mainAction); result.add(mainAction); } return result; }
// inherit doc comment protected JPopupMenu createPopupMenu() { if (TABLE.getSelectionModel().isSelectionEmpty()) { return null; } JPopupMenu menu = new SkinPopupMenu(); menu.add(new SkinMenuItem(LAUNCH_ACTION)); if (getMediaType().equals(MediaType.getAudioMediaType())) { menu.add(new SkinMenuItem(LAUNCH_OS_ACTION)); } if (hasExploreAction()) { menu.add(new SkinMenuItem(OPEN_IN_FOLDER_ACTION)); } if (areAllSelectedFilesMP4s()) { menu.add(DEMUX_MP4_AUDIO_ACTION); DEMUX_MP4_AUDIO_ACTION.setEnabled( !((DemuxMP4AudioAction) DEMUX_MP4_AUDIO_ACTION).isDemuxing()); } menu.add(new SkinMenuItem(CREATE_TORRENT_ACTION)); if (areAllSelectedFilesPlayable()) { menu.add(createAddToPlaylistSubMenu()); } menu.add(new SkinMenuItem(SEND_TO_FRIEND_ACTION)); menu.add(new SkinMenuItem(SEND_TO_ITUNES_ACTION)); menu.addSeparator(); menu.add(new SkinMenuItem(DELETE_ACTION)); menu.addSeparator(); int[] rows = TABLE.getSelectedRows(); boolean dirSelected = false; boolean fileSelected = false; for (int i = 0; i < rows.length; i++) { File f = DATA_MODEL.get(rows[i]).getFile(); if (f.isDirectory()) { dirSelected = true; // if (IncompleteFileManager.isTorrentFolder(f)) // torrentSelected = true; } else fileSelected = true; if (dirSelected && fileSelected) break; } DELETE_ACTION.setEnabled(true); LibraryFilesTableDataLine line = DATA_MODEL.get(rows[0]); menu.add(createSearchSubMenu(line)); return menu; }
public JPopupMenu getSingleRowSelectedPopupMenu() { JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(getMenuItme("运费划分(C)", 'C', "C")); popupMenu.add(getMenuItme("审核运费划分(N)", 'N', "N")); popupMenu.addSeparator(); popupMenu.add(getMenuItme("修改运费(Y)", 'Y', "Y")); popupMenu.addSeparator(); popupMenu.add(getMenuItme("刷新(R)", 'R', "R")); return popupMenu; }
// inherit doc comment protected JPopupMenu createPopupMenu() { if (TABLE.getSelectionModel().isSelectionEmpty()) return null; JPopupMenu menu = new SkinPopupMenu(); menu.add(new SkinMenuItem(LAUNCH_ACTION)); menu.add(new SkinMenuItem(LAUNCH_OS_ACTION)); if (hasExploreAction()) { menu.add(new SkinMenuItem(OPEN_IN_FOLDER_ACTION)); } menu.add(new SkinMenuItem(CREATE_TORRENT_ACTION)); menu.add(createAddToPlaylistSubMenu()); menu.add(new SkinMenuItem(SEND_TO_FRIEND_ACTION)); menu.add(new SkinMenuItem(SEND_TO_ITUNES_ACTION)); menu.addSeparator(); menu.add(new SkinMenuItem(DELETE_ACTION)); int[] rows = TABLE.getSelectedRows(); boolean dirSelected = false; boolean fileSelected = false; for (int i = 0; i < rows.length; i++) { File f = DATA_MODEL.get(rows[i]).getFile(); if (f.isDirectory()) { dirSelected = true; // if (IncompleteFileManager.isTorrentFolder(f)) // torrentSelected = true; } else fileSelected = true; if (dirSelected && fileSelected) break; } if (dirSelected) { DELETE_ACTION.setEnabled(true); } else { DELETE_ACTION.setEnabled(true); } menu.addSeparator(); menu.add(new SkinMenuItem(importToPlaylistAction)); menu.add(new SkinMenuItem(exportPlaylistAction)); menu.add(new SkinMenuItem(cleanupPlaylistAction)); menu.add(new SkinMenuItem(refreshID3TagsAction)); menu.addSeparator(); LibraryPlaylistsTableDataLine line = DATA_MODEL.get(rows[0]); menu.add(createSearchSubMenu(line)); return menu; }
@Override public void mouseReleased(MouseEvent e) { if (dragging && isValidDragAction(draggedNodes, getCurrentNode())) { dragging = false; JPopupMenu dragNdrop = new JPopupMenu(); JMenuItem item = new JMenuItem(JMeterUtils.getResString("insert_before")); // $NON-NLS-1$ item.addActionListener(actionHandler); item.setActionCommand(ReportDragNDrop.INSERT_BEFORE); dragNdrop.add(item); item = new JMenuItem(JMeterUtils.getResString("insert_after")); // $NON-NLS-1$ item.addActionListener(actionHandler); item.setActionCommand(ReportDragNDrop.INSERT_AFTER); dragNdrop.add(item); item = new JMenuItem(JMeterUtils.getResString("add_as_child")); // $NON-NLS-1$ item.addActionListener(actionHandler); item.setActionCommand(ReportDragNDrop.ADD); dragNdrop.add(item); dragNdrop.addSeparator(); item = new JMenuItem(JMeterUtils.getResString("cancel")); // $NON-NLS-1$ dragNdrop.add(item); displayPopUp(e, dragNdrop); } else { ReportGuiPackage.getInstance().getMainFrame().repaint(); } dragging = false; }
@Override public JPopupMenu getComponentPopupMenu() { if (popupMenu == null) { popupMenu = new JPopupMenu(Messages.CHART_COLON); timeRangeMenu = new JMenu(Messages.PLOTTER_TIME_RANGE_MENU); timeRangeMenu.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_TIME_RANGE_MENU)); popupMenu.add(timeRangeMenu); menuRBs = new JRadioButtonMenuItem[rangeNames.length]; ButtonGroup rbGroup = new ButtonGroup(); for (int i = 0; i < rangeNames.length; i++) { menuRBs[i] = new JRadioButtonMenuItem(rangeNames[i]); rbGroup.add(menuRBs[i]); menuRBs[i].addActionListener(this); if (viewRange == rangeValues[i]) { menuRBs[i].setSelected(true); } timeRangeMenu.add(menuRBs[i]); } popupMenu.addSeparator(); saveAsMI = new JMenuItem(Messages.PLOTTER_SAVE_AS_MENU_ITEM); saveAsMI.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_SAVE_AS_MENU_ITEM)); saveAsMI.addActionListener(this); popupMenu.add(saveAsMI); } return popupMenu; }
/** Create a popup menu for multiple objects */ @Override protected JPopupMenu createPopupMulti(int n_selected) { JPopupMenu p = new JPopupMenu(); p.add(new JLabel(I18N.get("controller.title") + ": " + n_selected)); p.addSeparator(); return p; }
private void configurePopupMenu(Object node) { if (node != null) { if (popup == null) { popup = new JPopupMenu(); } else { popup.removeAll(); } AbstractWorkspaceTreeNode treeNode = (AbstractWorkspaceTreeNode) node; List<PopupContent> actions = treeNode.getPopupActions(); for (PopupContent obj : actions) { if (obj instanceof PopupSubMenu) { popup.add((PopupSubMenu) obj); } else { Action action = (Action) obj; if (action == null) { popup.addSeparator(); } else { popup.add(new JMenuItem(action)); } } } ComponentOrientation o = ComponentOrientation.getOrientation(Locale.getDefault()); popup.applyComponentOrientation(o); } }
@Override protected JPopupMenu createPopup(Point p) { final List<Node> selectedElements = elementsDataTable.getElementsFromSelectedRows(); final Node clickedElement = elementsDataTable.getElementFromRow(table.rowAtPoint(p)); JPopupMenu contextMenu = new JPopupMenu(); // First add edges manipulators items: DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault(); Integer lastManipulatorType = null; for (NodesManipulator em : dlh.getNodesManipulators()) { em.setup(selectedElements.toArray(new Node[0]), clickedElement); if (lastManipulatorType == null) { lastManipulatorType = em.getType(); } if (lastManipulatorType != em.getType()) { contextMenu.addSeparator(); } lastManipulatorType = em.getType(); if (em.isAvailable()) { contextMenu.add( PopupMenuUtils.createMenuItemFromNodesManipulator( em, clickedElement, selectedElements.toArray(new Node[0]))); } } // Add AttributeValues manipulators submenu: Column column = elementsDataTable.getColumnAtIndex(table.columnAtPoint(p)); if (column != null) { contextMenu.add(PopupMenuUtils.createSubMenuFromRowColumn(clickedElement, column)); } return contextMenu; }
public JPopupMenu getMultiRowSelectedPopupMenu() { JPopupMenu popupMenu = new JPopupMenu(); JMenuItem item0 = getMenuItme("核销(H)", 'H', "H"); popupMenu.add(item0); JMenuItem item1 = getMenuItme("撤销核销(C)", 'C', "C"); popupMenu.add(item1); List<NPczbInfo> list = this.getSelectedRowList(); boolean doHX = false; boolean noHX = false; for (NPczbInfo one : list) { if (null == one.ENUM_JSZT || one.ENUM_JSZT == NPczbEnum.ENUM_JSZT.BFHX.key) { doHX = true; // 核销 } else if (one.ENUM_JSZT == NPczbEnum.ENUM_JSZT.HX.key) { noHX = true; // 撤销核销 } } if (doHX && !noHX) { item0.setEnabled(true); item1.setEnabled(false); } else if (!doHX && noHX) { item0.setEnabled(false); item1.setEnabled(true); } else { item0.setEnabled(false); item1.setEnabled(false); } popupMenu.addSeparator(); popupMenu.add(getMenuItme("刷新(R)", 'R', "R")); return popupMenu; }
/** Creates a custom popup menu for the table header. */ private JPopupMenu createHeaderPopup() { // Create popup menu. JPopupMenu popupMenu = new JPopupMenu(); JMenuItem defaultItem = new JMenuItem(); defaultItem.setAction(defaultConfigAction); popupMenu.add(defaultItem); JMenu optionsMenu = new JMenu(I18n.tr("More Options")); popupMenu.add(optionsMenu); popupMenu.addSeparator(); JMenuItem autosortItem = new JCheckBoxMenuItem(); autosortItem.setAction(autosortAction); optionsMenu.add(autosortItem); JMenuItem tooltipsItem = new JCheckBoxMenuItem(); tooltipsItem.setAction(tooltipsAction); optionsMenu.add(tooltipsItem); // Get column headings in default order. int columnCount = tableFormat.getColumnCount(); for (int i = 0; i < columnCount; i++) { // Create checkbox menu item for each column heading. String headerName = tableFormat.getColumnName(i); JMenuItem item = new JCheckBoxMenuItem(headerName, true); item.addActionListener(toggleColumnAction); popupMenu.add(item); } return popupMenu; }
public Popup() { setLayout(new FlowLayout()); add(t); ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent e) { t.setText(((JMenuItem) e.getSource()).getText()); } }; JMenuItem m = new JMenuItem("Hither"); m.addActionListener(al); popup.add(m); m = new JMenuItem("Yon"); m.addActionListener(al); popup.add(m); m = new JMenuItem("Afar"); m.addActionListener(al); popup.add(m); popup.addSeparator(); m = new JMenuItem("Stay Here"); m.addActionListener(al); popup.add(m); PopupListener pl = new PopupListener(); addMouseListener(pl); t.addMouseListener(pl); }
private JPopupMenu createMenu() { final JPopupMenu popup = new JPopupMenu(); JMenuItem itemStart = new JMenuItem(CMD_START_SERVER); itemStart.addActionListener(this); popup.add(itemStart); JMenuItem itemShutdown = new JMenuItem(CMD_SHUTDOWN_SERVER); itemShutdown.addActionListener(this); popup.add(itemShutdown); popup.addSeparator(); JMenuItem itemAbout = new JMenuItem(CMD_ABOUT); itemAbout.addActionListener(this); popup.add(itemAbout); popup.addSeparator(); JMenuItem itemExit = new JMenuItem(CMD_EXIT); itemExit.addActionListener(this); popup.add(itemExit); return popup; }
@Override protected JPopupMenu getPopupMenu() { JPopupMenu popupMenu = super.getPopupMenu(); popupMenu.addSeparator(); JMenuItem uploadItem = new JMenuItem(BundleUtil.getString(BundleUtil.Command_Upload)); uploadItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { upload(); JOptionPane.showMessageDialog(frame, "上传成功", "alert", JOptionPane.ERROR_MESSAGE); } catch (Exception e1) { e1.printStackTrace(); JOptionPane.showMessageDialog( frame, e1.getMessage(), "alert", JOptionPane.ERROR_MESSAGE); } } }); popupMenu.add(uploadItem); JMenuItem downloadItem = new JMenuItem(BundleUtil.getString(BundleUtil.Command_Download)); downloadItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { download(); } catch (Exception e1) { e1.printStackTrace(); JOptionPane.showMessageDialog( frame, e1.getMessage(), "alert", JOptionPane.ERROR_MESSAGE); } } }); popupMenu.add(downloadItem); JMenuItem deleteItem = new JMenuItem(BundleUtil.getString(BundleUtil.Command_Delete)); deleteItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { if (JOptionPane.showConfirmDialog(frame, "您是否确认删除?", "提示", JOptionPane.YES_NO_OPTION) == 0) { delete(); } } catch (Exception e1) { e1.printStackTrace(); JOptionPane.showMessageDialog( frame, e1.getMessage(), "alert", JOptionPane.ERROR_MESSAGE); } } }); popupMenu.add(deleteItem); return popupMenu; }
/** Create a popup menu for a single controller selection */ @Override protected JPopupMenu createPopupSingle(Controller ctrl) { JPopupMenu p = new JPopupMenu(); p.add(makeMenuLabel(getDescription(ctrl))); p.addSeparator(); if (TeslaAction.isConfigured()) p.add(new TeslaAction<Controller>(ctrl)); p.add(new PropertiesAction<Controller>(this, ctrl)); return p; }
@Override public JPopupMenu getSingleRowSelectedPopupMenu() { JPopupMenu popupMenu = new JPopupMenu(); if (!queryType || !DebugParameter.QUERY_PARA) { popupMenu.add(getMenuItme("新增加工配置(A)", 'A', "A")); popupMenu.add(getMenuItme("查询配置(Q)", 'Q', "Q")); popupMenu.addSeparator(); popupMenu.add(getMenuItme("修改加工配置(M)", 'M', "M")); popupMenu.add(getMenuItme("删除加工配置(D)", 'D', "D")); popupMenu.addSeparator(); } popupMenu.add(getMenuItme("刷新(R)", 'R', "R")); return popupMenu; }
/** * Inserts the given <code>command</command> to the <code>popupMenu</code> at the given <code>position</code>. * * @param popupMenu The popup menu to add the given <code>command</code> to. * @param command The command to insert. * @param pos the position where to insert the <code>command</code>. */ public static void insertCommandMenuItem( final JPopupMenu popupMenu, final Command command, final int pos) { final JMenuItem menuItem = command.createMenuItem(); if (menuItem == null) { return; } int insertPos = pos; if (command.isSeparatorBefore() && insertPos > 0) { if (insertPos == popupMenu.getComponentCount()) { final Component c = popupMenu.getComponent(insertPos - 1); if (!(c instanceof JSeparator)) { popupMenu.addSeparator(); insertPos++; } } else { final Component c = popupMenu.getComponent(insertPos); if (!(c instanceof JSeparator)) { popupMenu.insert(new JPopupMenu.Separator(), insertPos); insertPos++; } } } if (insertPos >= popupMenu.getComponentCount()) { popupMenu.add(menuItem); } else { popupMenu.insert(menuItem, insertPos); } insertPos++; if (command.isSeparatorAfter()) { if (insertPos == popupMenu.getComponentCount()) { popupMenu.addSeparator(); } else { final Component c = popupMenu.getComponent(insertPos); if (!(c instanceof JSeparator)) { popupMenu.insert(new JPopupMenu.Separator(), insertPos); } } } }
@Override public JPopupMenu getNullRowSelectedPopupMenu() { JPopupMenu popupMenu = new JPopupMenu(); if (!queryType || !DebugParameter.QUERY_PARA) { popupMenu.add(getMenuItme("新增加工配置(A)", 'A', "A")); popupMenu.addSeparator(); } popupMenu.add(getMenuItme("刷新(R)", 'R', "R")); return popupMenu; }
/** * <code>mouseRightPopupMenu</code> * * @param resource - <code>PwResource</code> - * @param viewCoords - <code>Point</code> - */ protected final void mouseRightPopupMenu(final PwResource resource, final Point viewCoords) { String partialPlanName = partialPlan.getPartialPlanName(); PwPlanningSequence planSequence = PlanWorks.getPlanWorks().getPlanSequence(partialPlan); JPopupMenu mouseRightPopup = new JPopupMenu(); JMenuItem nodeByKeyItem = new JMenuItem("Find by Key"); createNodeByKeyItem(nodeByKeyItem); mouseRightPopup.add(nodeByKeyItem); createOpenViewItems( partialPlan, partialPlanName, planSequence, mouseRightPopup, ViewConstants.RESOURCE_TRANSACTION_VIEW); JMenuItem overviewWindowItem = new JMenuItem("Overview Window"); createOverviewWindowItem(overviewWindowItem, this, viewCoords); mouseRightPopup.add(overviewWindowItem); JMenuItem raiseContentSpecItem = new JMenuItem("Raise Content Filter"); createRaiseContentSpecItem(raiseContentSpecItem); mouseRightPopup.add(raiseContentSpecItem); String timeMarkTitle = "Set Time Scale Line"; if (viewSet.doesViewFrameExist(ViewConstants.RESOURCE_TRANSACTION_VIEW)) { timeMarkTitle = timeMarkTitle.concat("/Snap to Resource Profile"); } JMenuItem timeMarkItem = new JMenuItem(timeMarkTitle); createTimeMarkItem(timeMarkItem, resource); mouseRightPopup.add(timeMarkItem); if (((PartialPlanViewSet) this.getViewSet()).getActiveResource() != null) { JMenuItem activeResourceItem = new JMenuItem("Snap to Active Resource"); createActiveResourceItem(activeResourceItem); mouseRightPopup.add(activeResourceItem); } if (((PartialPlanViewSet) this.getViewSet()).getActiveToken() != null) { JMenuItem activeResourceTransItem = new JMenuItem("Snap to Active Resource Transaction"); createActiveResourceTransItem(activeResourceTransItem); mouseRightPopup.add(activeResourceTransItem); } if (viewSet.doesViewFrameExist(ViewConstants.NAVIGATOR_VIEW)) { mouseRightPopup.addSeparator(); JMenuItem closeWindowsItem = new JMenuItem("Close Navigator Views"); createCloseNavigatorWindowsItem(closeWindowsItem); mouseRightPopup.add(closeWindowsItem); } createAllViewItems(partialPlan, partialPlanName, planSequence, mouseRightPopup); ViewGenerics.showPopupMenu(mouseRightPopup, this, viewCoords); } // end mouseRightPopupMenu
private void doPopup(java.awt.event.MouseEvent e) { javax.swing.JPopupMenu menu = new javax.swing.JPopupMenu(); menu.add(new javax.swing.JMenuItem(Actions.COPY_ACTION())); Actions.COPY_ACTION().putValue(javax.swing.Action.NAME, i18n.apply("menu.edit.copy")); menu.add(new javax.swing.JMenuItem(Actions.CUT_ACTION())); Actions.CUT_ACTION().putValue(javax.swing.Action.NAME, i18n.apply("menu.edit.cut")); menu.add(new javax.swing.JMenuItem(Actions.PASTE_ACTION())); Actions.PASTE_ACTION().putValue(javax.swing.Action.NAME, i18n.apply("menu.edit.paste")); menu.addSeparator(); menu.add(new javax.swing.JMenuItem(Actions.mouseQuickHelpAction(colorizer, i18n))); menu.show(this, e.getX(), e.getY()); }
/** * Method that returns the popup menu for a given mouse event. It will be called on each popup * event if the menu is enabled. If the menu is static caching can be used to prevent unnecessary * generation of menu objects. * * @param e Mouse event that triggered the popup menu. * @return A popup menu instance, or {@code null} if no popup menu should be shown. * @see #isPopupMenuEnabled() * @see #setPopupMenuEnabled(boolean) */ protected JPopupMenu getPopupMenu(MouseEvent e) { if (popupMenu == null) { popupMenu = new JPopupMenu(); popupMenu.add(actions.get("zoomIn")); // $NON-NLS-1$ popupMenu.add(actions.get("zoomOut")); // $NON-NLS-1$ popupMenu.add(actions.get("resetView")); // $NON-NLS-1$ popupMenu.addSeparator(); popupMenu.add(actions.get("exportImage")); // $NON-NLS-1$ popupMenu.add(actions.get("print")); // $NON-NLS-1$ } return popupMenu; }
public void mabeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { final JPopupMenu contextMenu = new JPopupMenu(); int row = view.getTable().rowAtPoint(e.getPoint()); ListTableModel<PatientModel> tModel = getTableModel(); PatientModel obj = tModel.getObject(row); int selected = view.getTable().getSelectedRow(); if (row == selected && obj != null) { contextMenu.add( new JMenuItem(new ReflectAction("カルテを開く", PatientSearchImpl.this, "openKarte"))); contextMenu.addSeparator(); // s.oh^ 2014/08/19 ID権限 // contextMenu.add(new JMenuItem(copyAction)); // contextMenu.add(new JMenuItem(new ReflectAction("受付登録", PatientSearchImpl.this, // "addAsPvt"))); // contextMenu.addSeparator(); if (!Project.isOtherCare()) { contextMenu.add(new JMenuItem(copyAction)); contextMenu.add( new JMenuItem(new ReflectAction("受付登録", PatientSearchImpl.this, "addAsPvt"))); contextMenu.addSeparator(); } // s.oh$ } JCheckBoxMenuItem item = new JCheckBoxMenuItem("年齢表示"); contextMenu.add(item); item.setSelected(ageDisplay); item.addActionListener( (ActionListener) EventHandler.create( ActionListener.class, PatientSearchImpl.this, "switchAgeDisplay")); contextMenu.show(e.getComponent(), e.getX(), e.getY()); } }
/** * Create and popup a command menu for when the user has clicked on the given xml node. * * @param theTree The XmlTree object displaying the current xml document. * @param node The xml node the user clicked on. * @param popup The popup menu to put the menu items in. * @return Did we add any items into the menu */ private boolean makePopupMenu(final XmlTree theTree, final Element node, JPopupMenu popup) { theTree.selectElement(node); String tagName = node.getTagName(); final Element parent = (Element) node.getParentNode(); boolean didone = false; JMenuItem mi; if (tagName.equals("default")) { lastClicked = node; JMenu moveMenu = new JMenu("Move to"); List folders = getFolders(); for (int i = 0; i < folders.size(); i++) { final Element newFolder = (Element) folders.get(i); if (!newFolder.isSameNode(parent)) { String name = newFolder.getAttribute(ATTR_NAME); mi = new JMenuItem(name); mi.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { moveParameterSet(parent, newFolder); } }); moveMenu.add(mi); } } popup.add(moveMenu); popup.addSeparator(); didone = true; } mi = new JMenuItem("Rename..."); mi.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { doRename(node); } }); popup.add(mi); didone = true; mi = new JMenuItem("Delete"); mi.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { doDeleteRequest(node); } }); popup.add(mi); didone = true; return didone; }
@Override public void populatePopupMenu(JPopupMenu menu) { List<? extends QuickFix> fixes = errors.get(getSelectedRow()).getQuickFixes(); if (!fixes.isEmpty()) { JMenu fixMenu = new ResourceMenu("quick_fixes"); for (QuickFix fix : fixes) { fixMenu.add(fix.getAction()); } menu.add(fixMenu); menu.addSeparator(); } super.populatePopupMenu(menu); }
/** * Fill the specified menu bar with the menu elements that have the given URI as their parent. * * <p>Existing elements on the menu bar will be removed. * * @param popupMenu The {@link JPopupMenu} to update * @param id The {@link URI} of the menu bar * @param contextualSelection The current selection for the context menu */ protected void populateContextMenu( JPopupMenu popupMenu, URI id, ContextualSelection contextualSelection) { popupMenu.removeAll(); MenuComponent menuDef = uriToMenuElement.get(id); if (menuDef == null) throw new IllegalArgumentException("Unknown menuBar " + id); if (!menuDef.getType().equals(MenuType.menu)) throw new IllegalArgumentException( "Element " + id + " is not a menu, but a " + menuDef.getType()); MenuOptions menuOptions = new MenuOptions(); menuOptions.setContextualSelection(contextualSelection); for (Component component : makeComponents(id, menuOptions)) if (component == null) popupMenu.addSeparator(); else popupMenu.add(component); }