List of usage examples for javax.swing JPopupMenu setLabel
@BeanProperty(description = "The label for the popup menu.") public void setLabel(String label)
From source file:org.esa.nest.dat.views.polarview.PolarView.java
@Override public JPopupMenu createPopupMenu(MouseEvent event) { final JPopupMenu popup = new JPopupMenu(); final JMenuItem itemNext = createMenuItem("Next"); popup.add(itemNext);//from www . j a va 2 s . co m itemNext.setEnabled(currentRecord < numRecords); final JMenuItem itemPrev = createMenuItem("Previous"); popup.add(itemPrev); itemPrev.setEnabled(currentRecord > 0); final JMenuItem itemColourScale = createMenuItem("Colour Scale"); popup.add(itemColourScale); final JMenu unitMenu = new JMenu("Unit"); popup.add(unitMenu); if (waveProductType == WaveProductType.WAVE_SPECTRA) { createCheckedMenuItem(unitTypes[Unit.AMPLITUDE.ordinal()], unitMenu, graphUnit == Unit.AMPLITUDE); createCheckedMenuItem(unitTypes[Unit.INTENSITY.ordinal()], unitMenu, graphUnit == Unit.INTENSITY); } else { createCheckedMenuItem(unitTypes[Unit.REAL.ordinal()], unitMenu, graphUnit == Unit.REAL); createCheckedMenuItem(unitTypes[Unit.IMAGINARY.ordinal()], unitMenu, graphUnit == Unit.IMAGINARY); createCheckedMenuItem(unitTypes[Unit.AMPLITUDE.ordinal()], unitMenu, graphUnit == Unit.AMPLITUDE); createCheckedMenuItem(unitTypes[Unit.INTENSITY.ordinal()], unitMenu, graphUnit == Unit.INTENSITY); } final JMenuItem itemExportReadout = createMenuItem("Export Readouts"); popup.add(itemExportReadout); popup.setLabel("Justification"); popup.setBorder(new BevelBorder(BevelBorder.RAISED)); popup.addPopupMenuListener(this); popup.show(this, event.getX(), event.getY()); return popup; }
From source file:org.esa.snap.graphbuilder.rcp.dialogs.support.GraphPanel.java
private void checkPopup(MouseEvent e) { if (e.isPopupTrigger()) { final JPopupMenu popup = new JPopupMenu(); popup.add(addMenu);//from w w w . ja v a 2s.co m if (selectedNode != null) { final JMenuItem item = new JMenuItem("Delete"); popup.add(item); item.setHorizontalTextPosition(JMenuItem.RIGHT); item.addActionListener(this); final NodeSource[] sources = selectedNode.getNode().getSources(); if (sources.length > 0) { final JMenu removeSourcedMenu = new JMenu("Remove Source"); for (NodeSource ns : sources) { final JMenuItem nsItem = new JMenuItem(ns.getSourceNodeId()); removeSourcedMenu.add(nsItem); nsItem.setHorizontalTextPosition(JMenuItem.RIGHT); nsItem.addActionListener(removeSourceListener); } popup.add(removeSourcedMenu); } } if (!graphEx.getGraphNodeList().isGraphComplete()) { final JMenuItem connectItem = new JMenuItem("Connect Graph", null); connectItem.setHorizontalTextPosition(JMenuItem.RIGHT); connectItem.addActionListener(connectListener); popup.add(connectItem); } popup.setLabel("Justification"); popup.setBorder(new BevelBorder(BevelBorder.RAISED)); popup.addPopupMenuListener(this); popup.show(this, e.getX(), e.getY()); showRightClickHelp = false; } }