List of usage examples for javax.swing JPopupMenu JPopupMenu
public JPopupMenu()
JPopupMenu
without an "invoker". From source file:com.mirth.connect.client.ui.Frame.java
/** * Creates the template task pane./*from www.ja va 2 s. co m*/ */ private void createAlertPane() { // Create Alert Edit Tasks Pane alertTasks = new JXTaskPane(); alertPopupMenu = new JPopupMenu(); alertTasks.setTitle("Alert Tasks"); alertTasks.setName(TaskConstants.ALERT_KEY); alertTasks.setFocusable(false); addTask(TaskConstants.ALERT_REFRESH, "Refresh", "Refresh the list of alerts.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/arrow_refresh.png")), alertTasks, alertPopupMenu); addTask(TaskConstants.ALERT_NEW, "New Alert", "Create a new alert.", "N", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/error_add.png")), alertTasks, alertPopupMenu); addTask(TaskConstants.ALERT_IMPORT, "Import Alert", "Import an alert from an XML file.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_go.png")), alertTasks, alertPopupMenu); addTask(TaskConstants.ALERT_EXPORT_ALL, "Export All Alerts", "Export all of the alerts to an XML file.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")), alertTasks, alertPopupMenu); addTask(TaskConstants.ALERT_EXPORT, "Export Alert", "Export the currently selected alert to an XML file.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")), alertTasks, alertPopupMenu); addTask(TaskConstants.ALERT_DELETE, "Delete Alert", "Delete the currently selected alert.", "L", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/error_delete.png")), alertTasks, alertPopupMenu); addTask(TaskConstants.ALERT_EDIT, "Edit Alert", "Edit the currently selected alert.", "", new ImageIcon( com.mirth.connect.client.ui.Frame.class.getResource("images/application_form_edit.png")), alertTasks, alertPopupMenu); addTask(TaskConstants.ALERT_ENABLE, "Enable Alert", "Enable the currently selected alert.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/control_play_blue.png")), alertTasks, alertPopupMenu); addTask(TaskConstants.ALERT_DISABLE, "Disable Alert", "Disable the currently selected alert.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/control_stop_blue.png")), alertTasks, alertPopupMenu); setNonFocusable(alertTasks); taskPaneContainer.add(alertTasks); }
From source file:de.huxhorn.lilith.swing.ViewActions.java
private void initPopup() { if (logger.isDebugEnabled()) logger.debug("initPopup()"); popup = new JPopupMenu(); JMenuItem showUnfilteredMenuItem = new JMenuItem(showUnfilteredEventAction); Font f = showUnfilteredMenuItem.getFont(); Font boldFont = f.deriveFont(Font.BOLD); showUnfilteredMenuItem.setFont(boldFont); popup.add(showUnfilteredMenuItem);/*w w w .j av a 2s .c o m*/ filterPopupMenu = new JMenu("Filter"); popup.add(filterPopupMenu); filterPopupMenu.add(closeFilterAction); filterPopupMenu.add(closeOtherFiltersAction); filterPopupMenu.add(closeAllFiltersAction); popup.addSeparator(); popup.add(saveConditionMenuAction); popup.addSeparator(); focusPopupMenu = new FocusMenu(mainFrame.getApplicationPreferences()); excludePopupMenu = new ExcludeMenu(mainFrame.getApplicationPreferences()); popup.add(focusPopupMenu); popup.add(excludePopupMenu); popup.addSeparator(); updateCustomCopyMenu(this.eventWrapper); copyPopupMenu = new JMenu("Copy"); popup.add(copyPopupMenu); copyPopupMenu.add(copySelectionAction); copyPopupMenu.addSeparator(); copyPopupMenu.add(copyEventAction); copyPopupMenu.addSeparator(); for (CopyToClipboardAction current : copyLoggingActions) { copyPopupMenu.add(current); } copyPopupMenu.addSeparator(); for (CopyToClipboardAction current : copyAccessActions) { copyPopupMenu.add(current); } copyPopupMenu.addSeparator(); copyPopupMenu.add(customCopyPopupMenu); sendToPopupMenu = new JMenu("Send to"); popup.add(sendToPopupMenu); popup.add(gotoSourceAction); }
From source file:com.t3.client.ui.T3Frame.java
private AssetPanel createAssetPanel() { final AssetPanel panel = new AssetPanel("mainAssetPanel"); panel.addImagePanelMouseListener(new MouseAdapter() { @Override/*from w w w. j ava 2 s . c o m*/ public void mouseReleased(MouseEvent e) { // TODO use for real popup logic // if (SwingUtilities.isLeftMouseButton(e)) { // if (e.getClickCount() == 2) { // // List<Object> idList = panel.getSelectedIds(); // if (idList == null || idList.size() == 0) { // return; // } // // final int index = (Integer) idList.get(0); // createZone(panel.getAsset(index)); // } // } if (SwingUtilities.isRightMouseButton(e) && TabletopTool.getPlayer().isGM()) { List<Object> idList = panel.getSelectedIds(); if (idList == null || idList.size() == 0) { return; } final int index = (Integer) idList.get(0); JPopupMenu menu = new JPopupMenu(); menu.add(new JMenuItem(new AbstractAction() { { putValue(NAME, I18N.getText("action.newMap")); } @Override public void actionPerformed(ActionEvent e) { createZone(panel.getAsset(index)); } })); panel.showImagePanelPopup(menu, e.getX(), e.getY()); } } private void createZone(Asset asset) { Zone zone = ZoneFactory.createZone(); zone.setName(asset.getName()); BufferedImage image = ImageManager.getImageAndWait(asset.getId()); if (image.getWidth() < 200 || image.getHeight() < 200) { zone.setBackgroundPaint(new DrawableTexturePaint(asset)); } else { zone.setMapAsset(asset.getId()); zone.setBackgroundPaint(new DrawableColorPaint(Color.black)); } MapPropertiesDialog newMapDialog = new MapPropertiesDialog(TabletopTool.getFrame()); newMapDialog.setZone(zone); newMapDialog.setVisible(true); if (newMapDialog.getStatus() == MapPropertiesDialog.Status.OK) { TabletopTool.addZone(zone); } } }); return panel; }
From source file:src.gui.ItTabbedPane.java
private JPopupMenu createPopupMenu() { popupMenu = new JPopupMenu(); popupMenu.add(new CloseAction("Close")); popupMenu.add(new CloseOthersAction("Close Others")); popupMenu.add(new CloseAllAction("Close All")); return popupMenu; }
From source file:edu.harvard.i2b2.previousquery.ui.QueryPreviousRunsPanel.java
private void createPopupMenu() { JMenuItem menuItem;//from w w w . j a v a 2s.co 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.vfsjfilechooser.filepane.VFSFilePane.java
@Override public JPopupMenu getComponentPopupMenu() { JPopupMenu popupMenu = getFileChooser().getComponentPopupMenu(); if (popupMenu != null) { return popupMenu; }//from w w w . j a v a 2s. com JMenu aViewMenu = getViewMenu(); if (contextMenu == null) { contextMenu = new JPopupMenu(); if (aViewMenu != null) { contextMenu.add(aViewMenu); if (listViewWindowsStyle) { contextMenu.addSeparator(); } } ActionMap actionMap = getActionMap(); Action refreshAction = actionMap.get(ACTION_REFRESH); Action aNewFolderAction = actionMap.get(ACTION_NEW_FOLDER); if (refreshAction != null) { contextMenu.add(refreshAction); if (listViewWindowsStyle && (aNewFolderAction != null)) { contextMenu.addSeparator(); } } if (aNewFolderAction != null) { contextMenu.add(aNewFolderAction); } } if (aViewMenu != null) { aViewMenu.getPopupMenu().setInvoker(aViewMenu); } return contextMenu; }
From source file:com.github.dougkelly88.FLIMPlateReaderGUI.FLIMClasses.GUIComponents.FLIMPanel.java
private void setControlDefaults() { String[] colName = { "Delays (ps)" }; int max = 16666; try {/*from w ww . j a va 2 s .c o m*/ max = Integer.parseInt(core_.getProperty("Laser", "Frequency")); } catch (Exception e) { } tableModel_ = new DelayTableModel(colName, (sap_.getDelaysArray()).get(0), 0, max, 25); tableModel_.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { sap_.setDelaysArray(0, tableModel_.getData()); fm_.setGatingData((sap_.getDelaysArray()).get(0)); var_.delays = tableModel_.getData(); } }); delayTable_ = new JTable() { @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component comp = super.prepareRenderer(renderer, row, column); int modelRow = convertRowIndexToModel(row); int modelColumn = convertColumnIndexToModel(column); if (modelColumn != 0 && modelRow != 0) { comp.setBackground(Color.GREEN); } return comp; } }; delayTable_.setModel(tableModel_); delayTable_.setSurrendersFocusOnKeystroke(true); delayTable_.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); JScrollPane scroller = new javax.swing.JScrollPane(delayTable_); delayTable_.setPreferredScrollableViewportSize(new java.awt.Dimension(60, 100)); delayTablePanel.setLayout(new BorderLayout()); delayTablePanel.add(scroller, BorderLayout.CENTER); final JPopupMenu popupMenu = new JPopupMenu(); JMenuItem deleteItem = new JMenuItem("Delete delay"); deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int r = delayTable_.getSelectedRow(); tableModel_.removeRow(r); } }); JMenuItem addItem = new JMenuItem("Add delay"); addItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int r = delayTable_.getSelectedRow(); tableModel_.insertRow(r + 1, 0); } }); popupMenu.add(addItem); popupMenu.add(deleteItem); delayTable_.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { // System.out.println("pressed"); } public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { JTable source = (JTable) e.getSource(); int row = source.rowAtPoint(e.getPoint()); int column = source.columnAtPoint(e.getPoint()); if (!source.isRowSelected(row)) source.changeSelection(row, column, false, false); popupMenu.show(e.getComponent(), e.getX(), e.getY()); } } }); // Set up slider controls mcpSlider_ = new SliderControl("MCP voltage (V)", 300, 850, 750); mcpVoltagePanel.setLayout(new BorderLayout()); mcpVoltagePanel.add(mcpSlider_, BorderLayout.SOUTH); mcpSlider_.addPropertyChangeListener(new java.beans.PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { mcpSliderPropertyChange(evt); } }); gatewidthSlider_ = new SliderControl("Gate width (ps)", 200, 7000, 3000); gatewidthPanel.setLayout(new BorderLayout()); gatewidthPanel.add(gatewidthSlider_, BorderLayout.SOUTH); gatewidthSlider_.addPropertyChangeListener(new java.beans.PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { gatewidthSliderPropertyChange(evt); } }); HRIControlsPanel.revalidate(); HRIControlsPanel.repaint(); slowDelaySlider_ = new SliderControl("Current delay setting (ps)", 0, 20000, 0); slowCurrentDelayPanel.setLayout(new BorderLayout()); slowCurrentDelayPanel.add(slowDelaySlider_, BorderLayout.SOUTH); slowDelaySlider_.addPropertyChangeListener(new java.beans.PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { slowDelaySlider_.setValue(tableModel_.validateData(slowDelaySlider_.getValue().intValue())); slowDelaySliderPropertyChange(evt); } }); fastDelaySlider_ = new SliderControl("Current delay setting (ps)", 0, 20000, 0); fastCurrentDelayPanel.setLayout(new BorderLayout()); fastCurrentDelayPanel.add(fastDelaySlider_, BorderLayout.SOUTH); fastDelaySlider_.addPropertyChangeListener(new java.beans.PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { fastDelaySlider_.setValue(tableModel_.validateData(fastDelaySlider_.getValue().intValue())); fastDelaySliderPropertyChange(evt); } }); delayBoxTabbedPane.revalidate(); delayBoxTabbedPane.repaint(); fm_ = new FindMaxpoint(); maxpointGraphPanel.setLayout(new BorderLayout()); chartPanel_ = new ChartPanel(fm_.getChart()); maxpointGraphPanel.add(chartPanel_, BorderLayout.NORTH); // for some reason maxpointGraphPanel's height and width are returned 0 // so hardcode for now... chartPanel_.setMaximumDrawWidth(500); chartPanel_.setMaximumDrawHeight(200); chartPanel_.setPreferredSize(new Dimension(500, 200)); // Set values for other controls based on underlying data to ensure // that all controls are in a consistent state. scanDelCheck.setSelected(sap_.getUseScanFLIM()); }
From source file:com.mirth.connect.client.ui.Frame.java
/** * Creates the template task pane./*from w w w .ja v a2 s.co m*/ */ private void createAlertEditPane() { // Create Alert Edit Tasks Pane alertEditTasks = new JXTaskPane(); alertEditPopupMenu = new JPopupMenu(); alertEditTasks.setTitle("Alert Edit Tasks"); alertEditTasks.setName(TaskConstants.ALERT_EDIT_KEY); alertEditTasks.setFocusable(false); addTask(TaskConstants.ALERT_EDIT_SAVE, "Save Alert", "Save all changes made to this alert.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/disk.png")), alertEditTasks, alertEditPopupMenu); addTask(TaskConstants.ALERT_EDIT_EXPORT, "Export Alert", "Export the currently selected alert to an XML file.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")), alertEditTasks, alertEditPopupMenu); setNonFocusable(alertEditTasks); taskPaneContainer.add(alertEditTasks); }
From source file:com.googlecode.vfsjfilechooser2.filepane.VFSFilePane.java
@Override public JPopupMenu getComponentPopupMenu() { JPopupMenu popupMenu = getFileChooser().getComponentPopupMenu(); if (popupMenu != null) { return popupMenu; }/*from www .j a v a 2 s. c o m*/ JMenu aViewMenu = getViewMenu(); if (contextMenu == null) { contextMenu = new JPopupMenu(); if (aViewMenu != null) { contextMenu.add(aViewMenu); if (listViewWindowsStyle) { contextMenu.addSeparator(); } } ActionMap actionMap = getActionMap(); Action refreshAction = actionMap.get(ACTION_REFRESH); Action aNewFolderAction = actionMap.get(ACTION_NEW_FOLDER); Action showHiddenFiles = actionMap.get(ACTION_VIEW_HIDDEN); if (refreshAction != null) { contextMenu.add(refreshAction); if (listViewWindowsStyle && (aNewFolderAction != null)) { contextMenu.addSeparator(); } } if (showHiddenFiles != null) { JCheckBoxMenuItem menuitem = new JCheckBoxMenuItem(showHiddenFiles); menuitem.setSelected((Boolean) showHiddenFiles.getValue(Action.SELECTED_KEY)); contextMenu.add(menuitem); } if (aNewFolderAction != null) { contextMenu.add(aNewFolderAction); } } if (aViewMenu != null) { aViewMenu.getPopupMenu().setInvoker(aViewMenu); } return contextMenu; }
From source file:com.mirth.connect.client.ui.Frame.java
/** * Creates the channel edit task pane.//from ww w . j av a 2 s .c om */ private void createChannelEditPane() { // Create Channel Edit Tasks Pane channelEditTasks = new JXTaskPane(); channelEditPopupMenu = new JPopupMenu(); channelEditTasks.setTitle("Channel Tasks"); channelEditTasks.setName(TaskConstants.CHANNEL_EDIT_KEY); channelEditTasks.setFocusable(false); addTask(TaskConstants.CHANNEL_EDIT_SAVE, "Save Changes", "Save all changes made to this channel.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/disk.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_VALIDATE, "Validate Connector", "Validate the currently visible connector.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/accept.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_NEW_DESTINATION, "New Destination", "Create a new destination.", "N", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/add.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_DELETE_DESTINATION, "Delete Destination", "Delete the currently selected destination.", "L", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/delete.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_CLONE_DESTINATION, "Clone Destination", "Clones the currently selected destination.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/page_copy.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_ENABLE_DESTINATION, "Enable Destination", "Enable the currently selected destination.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/control_play_blue.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_DISABLE_DESTINATION, "Disable Destination", "Disable the currently selected destination.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/control_stop_blue.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_MOVE_DESTINATION_UP, "Move Dest. Up", "Move the currently selected destination up.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/arrow_up.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_MOVE_DESTINATION_DOWN, "Move Dest. Down", "Move the currently selected destination down.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/arrow_down.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_FILTER, UIConstants.EDIT_FILTER, "Edit the filter for the current connector.", "F", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/table_edit.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_TRANSFORMER, UIConstants.EDIT_TRANSFORMER, "Edit the transformer for the current connector.", "T", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/table_edit.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_RESPONSE_TRANSFORMER, UIConstants.EDIT_RESPONSE_TRANSFORMER, "Edit the response transformer for the current connector.", "R", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/table_edit.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_IMPORT_CONNECTOR, "Import Connector", "Import the currently displayed connector from an XML file.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_go.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_EXPORT_CONNECTOR, "Export Connector", "Export the currently displayed connector to an XML file.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_EXPORT, "Export Channel", "Export the currently selected channel to an XML file.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/report_disk.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_VALIDATE_SCRIPT, "Validate Script", "Validate the currently viewed script.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/accept.png")), channelEditTasks, channelEditPopupMenu); addTask(TaskConstants.CHANNEL_EDIT_DEPLOY, "Deploy Channel", "Deploy the currently selected channel.", "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/arrow_redo.png")), channelEditTasks, channelEditPopupMenu); setNonFocusable(channelEditTasks); taskPaneContainer.add(channelEditTasks); }