List of usage examples for javax.swing JPopupMenu JPopupMenu
public JPopupMenu()
JPopupMenu
without an "invoker". From source file:net.sf.jabref.gui.openoffice.OpenOfficePanel.java
private void showSettingsPopup() { JPopupMenu menu = new JPopupMenu(); final JCheckBoxMenuItem autoSync = new JCheckBoxMenuItem( Localization.lang("Automatically sync bibliography when inserting citations"), preferences.syncWhenCiting()); final JRadioButtonMenuItem useActiveBase = new JRadioButtonMenuItem( Localization.lang("Look up BibTeX entries in the active tab only")); final JRadioButtonMenuItem useAllBases = new JRadioButtonMenuItem( Localization.lang("Look up BibTeX entries in all open databases")); final JMenuItem clearConnectionSettings = new JMenuItem(Localization.lang("Clear connection settings")); ButtonGroup bg = new ButtonGroup(); bg.add(useActiveBase);//ww w .jav a 2 s. co m bg.add(useAllBases); if (preferences.useAllDatabases()) { useAllBases.setSelected(true); } else { useActiveBase.setSelected(true); } autoSync.addActionListener(e -> preferences.setSyncWhenCiting(autoSync.isSelected())); useAllBases.addActionListener(e -> preferences.setUseAllDatabases(useAllBases.isSelected())); useActiveBase.addActionListener(e -> preferences.setUseAllDatabases(!useActiveBase.isSelected())); clearConnectionSettings.addActionListener(e -> frame.output(preferences.clearConnectionSettings())); menu.add(autoSync); menu.addSeparator(); menu.add(useActiveBase); menu.add(useAllBases); menu.addSeparator(); menu.add(clearConnectionSettings); menu.show(settingsB, 0, settingsB.getHeight()); }
From source file:it.unibas.spicygui.vista.JLayeredPaneCorrespondences.java
private void creaPopUpMappingTaskTreeTargetDuplicate() { this.popUpMenuTargetDuplicate = new JPopupMenu(); MappingTask mappingTask = scenario.getMappingTask(); if (mappingTask != null) { this.popUpMenuTargetDuplicate .add(new ActionDuplicateSetNode(this, targetSchemaTree, mappingTask.getTargetProxy())); }//from w w w .ja v a2 s . c o m }
From source file:it.unibas.spicygui.vista.JLayeredPaneCorrespondences.java
private void creaPopUpMappingTaskTreeTargetDeleteDuplicate() { this.popUpMenuTargetDeleteDuplicate = new JPopupMenu(); MappingTask mappingTask = scenario.getMappingTask(); if (mappingTask != null) { this.popUpMenuTargetDeleteDuplicate.add( new ActionDeleteDuplicateSetCloneNode(this, targetSchemaTree, mappingTask.getTargetProxy())); this.popUpMenuTargetDeleteDuplicate .add(new ActionSelectionCondition(this, targetSchemaTree, mappingTask.getTargetProxy())); }//from ww w. j a v a 2 s . co m }
From source file:org.jets3t.apps.cockpit.Cockpit.java
/** * Initialise the application's menu bar. *///w w w. j a va 2s .c om private void initMenus() { JMenuBar appMenuBar = new JMenuBar(); if (this.isStandAloneApplication && OS_NAME_MAC.equals(System.getProperty("os.name"))) { /* * We need to check we're running on a Mac before adding the menu to the * owner frame, otherwise the menus will be displayed *behind* the main * GUI panel on Windows Vista and later [sigh] */ ownerFrame.setJMenuBar(appMenuBar); } else { this.setJMenuBar(appMenuBar); } // Service menu JMenu serviceMenu = new JMenu("Service"); loginMenuItem = new JMenuItem("Log in..."); loginMenuItem.setActionCommand("LoginEvent"); loginMenuItem.addActionListener(this); guiUtils.applyIcon(loginMenuItem, "/images/nuvola/16x16/actions/connect_creating.png"); serviceMenu.add(loginMenuItem); logoutMenuItem = new JMenuItem("Log out"); logoutMenuItem.setActionCommand("LogoutEvent"); logoutMenuItem.addActionListener(this); guiUtils.applyIcon(logoutMenuItem, "/images/nuvola/16x16/actions/connect_no.png"); serviceMenu.add(logoutMenuItem); loginSwitchMenu = new JMenu("Switch login"); loginSwitchMenu.addActionListener(this); serviceMenu.add(new JSeparator()); guiUtils.applyIcon(loginSwitchMenu, "/images/nuvola/16x16/actions/connect_established.png"); serviceMenu.add(loginSwitchMenu); loginSwitchMenu.setEnabled(false); if (isStandAloneApplication) { serviceMenu.add(new JSeparator()); JMenuItem quitMenuItem = new JMenuItem("Quit"); quitMenuItem.setActionCommand("QuitEvent"); quitMenuItem.addActionListener(this); guiUtils.applyIcon(quitMenuItem, "/images/nuvola/16x16/actions/exit.png"); serviceMenu.add(quitMenuItem); } logoutMenuItem.setEnabled(false); // Bucket action menu. bucketActionMenu = new JPopupMenu(); refreshBucketMenuItem = new JMenuItem("Refresh bucket listing"); refreshBucketMenuItem.setActionCommand("RefreshBuckets"); refreshBucketMenuItem.addActionListener(this); guiUtils.applyIcon(refreshBucketMenuItem, "/images/nuvola/16x16/actions/reload.png"); bucketActionMenu.add(refreshBucketMenuItem); viewBucketPropertiesMenuItem = new JMenuItem("View bucket properties..."); viewBucketPropertiesMenuItem.setActionCommand("ViewBucketProperties"); viewBucketPropertiesMenuItem.addActionListener(this); guiUtils.applyIcon(viewBucketPropertiesMenuItem, "/images/nuvola/16x16/actions/viewmag.png"); bucketActionMenu.add(viewBucketPropertiesMenuItem); updateBucketACLMenuItem = new JMenuItem("Update bucket's Access Control List..."); updateBucketACLMenuItem.setActionCommand("UpdateBucketACL"); updateBucketACLMenuItem.addActionListener(this); guiUtils.applyIcon(updateBucketACLMenuItem, "/images/nuvola/16x16/actions/encrypted.png"); bucketActionMenu.add(updateBucketACLMenuItem); updateBucketRequesterPaysStatusMenuItem = new JMenuItem("Update bucket's Requester Pays status..."); updateBucketRequesterPaysStatusMenuItem.setActionCommand("UpdateBucketRequesterPaysStatus"); updateBucketRequesterPaysStatusMenuItem.addActionListener(this); guiUtils.applyIcon(updateBucketRequesterPaysStatusMenuItem, "/images/nuvola/16x16/actions/identity.png"); bucketActionMenu.add(updateBucketRequesterPaysStatusMenuItem); bucketActionMenu.add(new JSeparator()); createBucketMenuItem = new JMenuItem("Create new bucket..."); createBucketMenuItem.setActionCommand("CreateBucket"); createBucketMenuItem.addActionListener(this); guiUtils.applyIcon(createBucketMenuItem, "/images/nuvola/16x16/actions/viewmag+.png"); bucketActionMenu.add(createBucketMenuItem); JMenuItem thirdPartyBucketMenuItem = new JMenuItem("Add third-party bucket..."); thirdPartyBucketMenuItem.setActionCommand("AddThirdPartyBucket"); thirdPartyBucketMenuItem.addActionListener(this); guiUtils.applyIcon(thirdPartyBucketMenuItem, "/images/nuvola/16x16/actions/viewmagfit.png"); bucketActionMenu.add(thirdPartyBucketMenuItem); bucketActionMenu.add(new JSeparator()); deleteBucketMenuItem = new JMenuItem("Delete bucket..."); deleteBucketMenuItem.setActionCommand("DeleteBucket"); deleteBucketMenuItem.addActionListener(this); guiUtils.applyIcon(deleteBucketMenuItem, "/images/nuvola/16x16/actions/cancel.png"); bucketActionMenu.add(deleteBucketMenuItem); viewBucketPropertiesMenuItem.setEnabled(false); refreshBucketMenuItem.setEnabled(false); createBucketMenuItem.setEnabled(false); updateBucketACLMenuItem.setEnabled(false); updateBucketRequesterPaysStatusMenuItem.setEnabled(false); deleteBucketMenuItem.setEnabled(false); // Object action menu. objectActionMenu = new JPopupMenu(); refreshObjectMenuItem = new JMenuItem("Refresh object listing"); refreshObjectMenuItem.setActionCommand("RefreshObjects"); refreshObjectMenuItem.addActionListener(this); guiUtils.applyIcon(refreshObjectMenuItem, "/images/nuvola/16x16/actions/reload.png"); objectActionMenu.add(refreshObjectMenuItem); viewOrModifyObjectAttributesMenuItem = new JMenuItem("View or Modify object attributes..."); viewOrModifyObjectAttributesMenuItem.setActionCommand("ViewOrModifyObjectAttributes"); viewOrModifyObjectAttributesMenuItem.addActionListener(this); guiUtils.applyIcon(viewOrModifyObjectAttributesMenuItem, "/images/nuvola/16x16/actions/viewmag.png"); objectActionMenu.add(viewOrModifyObjectAttributesMenuItem); copyObjectsMenuItem = new JMenuItem("Copy or Move objects..."); copyObjectsMenuItem.setActionCommand("CopyObjects"); copyObjectsMenuItem.addActionListener(this); guiUtils.applyIcon(copyObjectsMenuItem, "/images/nuvola/16x16/actions/filenew.png"); objectActionMenu.add(copyObjectsMenuItem); updateObjectACLMenuItem = new JMenuItem("View or Modify Access Control Lists..."); updateObjectACLMenuItem.setActionCommand("UpdateObjectACL"); updateObjectACLMenuItem.addActionListener(this); guiUtils.applyIcon(updateObjectACLMenuItem, "/images/nuvola/16x16/actions/encrypted.png"); objectActionMenu.add(updateObjectACLMenuItem); downloadObjectMenuItem = new JMenuItem("Download objects..."); downloadObjectMenuItem.setActionCommand("DownloadObjects"); downloadObjectMenuItem.addActionListener(this); guiUtils.applyIcon(downloadObjectMenuItem, "/images/nuvola/16x16/actions/1downarrow.png"); objectActionMenu.add(downloadObjectMenuItem); uploadFilesMenuItem = new JMenuItem("Upload files..."); uploadFilesMenuItem.setActionCommand("UploadFiles"); uploadFilesMenuItem.addActionListener(this); guiUtils.applyIcon(uploadFilesMenuItem, "/images/nuvola/16x16/actions/1uparrow.png"); objectActionMenu.add(uploadFilesMenuItem); objectActionMenu.add(new JSeparator()); generatePublicGetUrls = new JMenuItem("Generate Public GET URLs..."); generatePublicGetUrls.setActionCommand("GeneratePublicGetURLs"); generatePublicGetUrls.addActionListener(this); guiUtils.applyIcon(generatePublicGetUrls, "/images/nuvola/16x16/actions/wizard.png"); objectActionMenu.add(generatePublicGetUrls); generateTorrentUrl = new JMenuItem("Generate Torrent URL..."); generateTorrentUrl.setActionCommand("GenerateTorrentURL"); generateTorrentUrl.addActionListener(this); guiUtils.applyIcon(generateTorrentUrl, "/images/nuvola/16x16/actions/wizard.png"); objectActionMenu.add(generateTorrentUrl); objectActionMenu.add(new JSeparator()); deleteObjectMenuItem = new JMenuItem("Delete objects..."); deleteObjectMenuItem.setActionCommand("DeleteObjects"); deleteObjectMenuItem.addActionListener(this); guiUtils.applyIcon(deleteObjectMenuItem, "/images/nuvola/16x16/actions/cancel.png"); objectActionMenu.add(deleteObjectMenuItem); viewOrModifyObjectAttributesMenuItem.setEnabled(false); copyObjectsMenuItem.setEnabled(false); refreshObjectMenuItem.setEnabled(false); updateObjectACLMenuItem.setEnabled(false); downloadObjectMenuItem.setEnabled(false); uploadFilesMenuItem.setEnabled(false); generatePublicGetUrls.setEnabled(false); generateTorrentUrl.setEnabled(false); deleteObjectMenuItem.setEnabled(false); // Tools menu. JMenu toolsMenu = new JMenu("Tools"); bucketLoggingMenuItem = new JMenuItem("Configure Bucket logging..."); bucketLoggingMenuItem.setActionCommand("BucketLogging"); bucketLoggingMenuItem.addActionListener(this); bucketLoggingMenuItem.setEnabled(false); guiUtils.applyIcon(bucketLoggingMenuItem, "/images/nuvola/16x16/actions/toggle_log.png"); toolsMenu.add(bucketLoggingMenuItem); manageDistributionsMenuItem = new JMenuItem("CloudFront Distributions..."); manageDistributionsMenuItem.setActionCommand("ManageDistributions"); manageDistributionsMenuItem.addActionListener(this); guiUtils.applyIcon(manageDistributionsMenuItem, "/images/nuvola/16x16/actions/irkick.png"); manageDistributionsMenuItem.setEnabled(false); toolsMenu.add(manageDistributionsMenuItem); toolsMenu.add(new JSeparator()); preferencesDialogMenuItem = new JMenuItem("Preferences..."); preferencesDialogMenuItem.setActionCommand("PreferencesDialog"); preferencesDialogMenuItem.addActionListener(this); guiUtils.applyIcon(preferencesDialogMenuItem, "/images/nuvola/16x16/actions/configure.png"); toolsMenu.add(preferencesDialogMenuItem); // Help menu. JMenu helpMenu = new JMenu("Help"); cockpitHelpMenuItem = new JMenuItem("Cockpit Guide"); guiUtils.applyIcon(cockpitHelpMenuItem, "/images/nuvola/16x16/actions/help.png"); cockpitHelpMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { followHyperlink(new URL(JETS3T_COCKPIT_HELP_PAGE), "_blank"); } catch (MalformedURLException ex) { throw new IllegalStateException("Invalid URL embedded in program: " + JETS3T_COCKPIT_HELP_PAGE); } } }); helpMenu.add(cockpitHelpMenuItem); amazonS3HelpMenuItem = new JMenuItem("Amazon S3"); guiUtils.applyIcon(amazonS3HelpMenuItem, "/images/nuvola/16x16/actions/gohome.png"); amazonS3HelpMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { followHyperlink(new URL(AMAZON_S3_PAGE), "_blank"); } catch (MalformedURLException ex) { throw new IllegalStateException("Invalid URL embedded in program: " + AMAZON_S3_PAGE); } } }); helpMenu.add(amazonS3HelpMenuItem); // Build application menu bar. appMenuBar.add(serviceMenu); appMenuBar.add(toolsMenu); appMenuBar.add(helpMenu); }
From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_link.java
@Override public void doPopup(final MouseEvent e, final int row, final Object itemId) { JPopupMenu popup = new JPopupMenu(); final ITableRowFilter rf = callback.getVisualizationState().getTableRowFilter(); final List<Link> linkRowsInTheTable = getVisibleElementsInTable(); /* Add the popup menu option of the filters */ final List<Link> selectedLinks = (List<Link>) (List<?>) getSelectedElements().getFirst(); if (!selectedLinks.isEmpty()) { final JMenu submenuFilters = new JMenu("Filters"); final JMenuItem filterKeepElementsAffectedThisLayer = new JMenuItem( "This layer: Keep elements associated to this link traffic"); final JMenuItem filterKeepElementsAffectedAllLayers = new JMenuItem( "All layers: Keep elements associated to this link traffic"); submenuFilters.add(filterKeepElementsAffectedThisLayer); if (callback.getDesign().getNumberOfLayers() > 1) submenuFilters.add(filterKeepElementsAffectedAllLayers); filterKeepElementsAffectedThisLayer.addActionListener(new ActionListener() { @Override/*from www. j av a 2 s .co m*/ public void actionPerformed(ActionEvent e) { if (selectedLinks.size() > 1) throw new RuntimeException(); TBFToFromCarriedTraffic filter = new TBFToFromCarriedTraffic(selectedLinks.get(0), true); callback.getVisualizationState().updateTableRowFilter(filter); callback.updateVisualizationJustTables(); } }); filterKeepElementsAffectedAllLayers.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (selectedLinks.size() > 1) throw new RuntimeException(); TBFToFromCarriedTraffic filter = new TBFToFromCarriedTraffic(selectedLinks.get(0), false); callback.getVisualizationState().updateTableRowFilter(filter); callback.updateVisualizationJustTables(); } }); popup.add(submenuFilters); popup.addSeparator(); } if (callback.getVisualizationState().isNetPlanEditable()) { popup.add(getAddOption()); for (JComponent item : getExtraAddOptions()) popup.add(item); } if (!linkRowsInTheTable.isEmpty()) { if (callback.getVisualizationState().isNetPlanEditable()) { if (row != -1) { if (popup.getSubElements().length > 0) popup.addSeparator(); JMenuItem removeItem = new JMenuItem("Remove " + networkElementType); removeItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { NetPlan netPlan = callback.getDesign(); try { Link link = netPlan.getLinkFromId((long) itemId); link.remove(); callback.getVisualizationState() .recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } catch (Throwable ex) { ErrorHandling.addErrorOrException(ex, getClass()); ErrorHandling.showErrorDialog("Unable to remove " + networkElementType); } } }); popup.add(removeItem); } addPopupMenuAttributeOptions(e, row, itemId, popup); JMenuItem removeItems = new JMenuItem("Remove all " + networkElementType + "s in table"); removeItems.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { NetPlan netPlan = callback.getDesign(); try { if (rf == null) netPlan.removeAllLinks(); else for (Link ee : linkRowsInTheTable) ee.remove(); callback.getVisualizationState() .recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } catch (Throwable ex) { ex.printStackTrace(); ErrorHandling.showErrorDialog(ex.getMessage(), "Unable to remove all " + networkElementType + "s"); } } }); popup.add(removeItems); List<JComponent> extraOptions = getExtraOptions(row, itemId); if (!extraOptions.isEmpty()) { if (popup.getSubElements().length > 0) popup.addSeparator(); for (JComponent item : extraOptions) popup.add(item); } } List<JComponent> forcedOptions = getForcedOptions(); if (!forcedOptions.isEmpty()) { if (popup.getSubElements().length > 0) popup.addSeparator(); for (JComponent item : forcedOptions) popup.add(item); } } popup.show(e.getComponent(), e.getX(), e.getY()); }
From source file:net.sf.jabref.openoffice.OpenOfficePanel.java
private void showSettingsPopup() { JPopupMenu menu = new JPopupMenu(); final JCheckBoxMenuItem autoSync = new JCheckBoxMenuItem( Localization.lang("Automatically sync bibliography when inserting citations"), Globals.prefs.getBoolean(JabRefPreferences.SYNC_OO_WHEN_CITING)); final JRadioButtonMenuItem useActiveBase = new JRadioButtonMenuItem( Localization.lang("Look up BibTeX entries in the active tab only")); final JRadioButtonMenuItem useAllBases = new JRadioButtonMenuItem( Localization.lang("Look up BibTeX entries in all open databases")); final JMenuItem clearConnectionSettings = new JMenuItem(Localization.lang("Clear connection settings")); ButtonGroup bg = new ButtonGroup(); bg.add(useActiveBase);//from ww w.j a v a2 s.c o m bg.add(useAllBases); if (Globals.prefs.getBoolean(JabRefPreferences.USE_ALL_OPEN_BASES)) { useAllBases.setSelected(true); } else { useActiveBase.setSelected(true); } autoSync.addActionListener( e -> Globals.prefs.putBoolean(JabRefPreferences.SYNC_OO_WHEN_CITING, autoSync.isSelected())); useAllBases.addActionListener( e -> Globals.prefs.putBoolean(JabRefPreferences.USE_ALL_OPEN_BASES, useAllBases.isSelected())); useActiveBase.addActionListener( e -> Globals.prefs.putBoolean(JabRefPreferences.USE_ALL_OPEN_BASES, !useActiveBase.isSelected())); clearConnectionSettings.addActionListener(e -> { Globals.prefs.clear(JabRefPreferences.OO_PATH); Globals.prefs.clear(JabRefPreferences.OO_EXECUTABLE_PATH); Globals.prefs.clear(JabRefPreferences.OO_JARS_PATH); frame.output(Localization.lang("Cleared connection settings.")); }); menu.add(autoSync); menu.addSeparator(); menu.add(useActiveBase); menu.add(useAllBases); menu.addSeparator(); menu.add(clearConnectionSettings); menu.show(settingsB, 0, settingsB.getHeight()); }
From source file:edu.harvard.i2b2.previousquery.QueryPreviousRunsPanel.java
private void createPopupMenu() { JMenuItem menuItem;//from w w w . j a v a2s. c o m //Create the popup menu. JPopupMenu popup = new JPopupMenu(); menuItem = new JMenuItem("Rename ..."); menuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK)); menuItem.addActionListener(this); popup.add(menuItem); /*popup.add(new javax.swing.JSeparator());*/ menuItem = new JMenuItem("Delete"); menuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK)); menuItem.addActionListener(this); popup.add(menuItem); popup.add(new javax.swing.JSeparator()); menuItem = new JMenuItem("Refresh All"); menuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK)); menuItem.addActionListener(this); popup.add(menuItem); //Add listener to the tree MouseListener popupListener = new PreviousRunsTreePopupListener(popup); jTree1.addMouseListener(popupListener); jTree1.addMouseMotionListener(new PreviousRunsTreeMouseMoveListener()); }
From source file:net.sf.jabref.gui.JabRefFrame.java
private JPopupMenu tabPopupMenu() { JPopupMenu popupMenu = new JPopupMenu(); // Close actions JMenuItem close = new JMenuItem(Localization.lang("Close")); JMenuItem closeOthers = new JMenuItem(Localization.lang("Close Others")); JMenuItem closeAll = new JMenuItem(Localization.lang("Close All")); close.addActionListener(closeDatabaseAction); closeOthers.addActionListener(closeOtherDatabasesAction); closeAll.addActionListener(closeAllDatabasesAction); popupMenu.add(close);//from w ww. j a va2s . c o m popupMenu.add(closeOthers); popupMenu.add(closeAll); popupMenu.addSeparator(); JMenuItem databaseProperties = new JMenuItem(Localization.lang("Database properties")); databaseProperties.addActionListener(this.databaseProperties); popupMenu.add(databaseProperties); JMenuItem bibtexKeyPatternBtn = new JMenuItem(Localization.lang("BibTeX key patterns")); bibtexKeyPatternBtn.addActionListener(bibtexKeyPattern); popupMenu.add(bibtexKeyPatternBtn); JMenuItem manageSelectorsBtn = new JMenuItem(Localization.lang("Manage content selectors")); manageSelectorsBtn.addActionListener(manageSelectors); popupMenu.add(manageSelectorsBtn); return popupMenu; }
From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java
/** * Build the popup menu to switch between typeAnimation. * works only when statistic has observations * Called by MouseListener /*from ww w .jav a2s. c om*/ * Event wird nur bearbeitet, wenn die Simulation angehalten ist * Im anderen Fall kann der Viewer (inbes. Applet) ueberlastet sein * @param event MouseEvent */ private void checkPopupMenu(MouseEvent event) { //System.out.println("StatisticGrafic.checkPopupMenu"); ViewerPanel viewer = this.statistic.getModel().getViewer(); if (viewer != null && viewer.getSimulationThread() != null && !viewer.getSimulationThread().isWorking()) { // Event wird nur bearbeitet, wenn die Simulation angehalten ist // Im anderen Fall kann der Viewer (inbes. Applet) ueberlastet sein if (event.isPopupTrigger() && this.statistic.hasValue()) { JPopupMenu popup = new JPopupMenu(); JMenuItem mi = new JMenuItem(StatisticGrafic.TEXT_POPUP_MENU[0]); mi.addActionListener(this); popup.add(mi); mi = new JMenuItem(StatisticGrafic.TEXT_POPUP_MENU[1]); mi.addActionListener(this); popup.add(mi); popup.show(event.getComponent(), event.getX(), event.getY()); } } }
From source file:edu.ku.brc.specify.tasks.ExpressSearchTask.java
/** * Shows the Reset menu.//from www.j a va 2 s . c o m * @param e the mouse event */ protected void showContextMenu(MouseEvent e) { if (e.isPopupTrigger()) { JPopupMenu popup = new JPopupMenu(); JMenuItem menuItem = new JMenuItem(UIRegistry.getResourceString("ES_TEXT_RESET")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ex) { searchText.setEnabled(true); searchText.setBackground(textBGColor); searchText.setText(""); if (statusBar != null) { statusBar.setProgressDone(EXPRESSSEARCH); } } }); popup.add(menuItem); popup.show(e.getComponent(), e.getX(), e.getY()); } }