List of usage examples for javax.swing JMenuItem setActionCommand
public void setActionCommand(String actionCommand)
From source file:javazoom.jlgui.player.amp.playlist.ui.PlaylistUI.java
public void loadUI() { removeAll();/* www. ja v a 2 s . co m*/ ui.getPlaylistPanel().setParent(this); add(ui.getAcPlSlider(), ui.getAcPlSlider().getConstraints()); ui.getAcPlSlider().setValue(100); ui.getAcPlSlider().removeChangeListener(this); ui.getAcPlSlider().addChangeListener(this); add(ui.getAcPlUp(), ui.getAcPlUp().getConstraints()); ui.getAcPlUp().removeActionListener(this); ui.getAcPlUp().addActionListener(this); add(ui.getAcPlDown(), ui.getAcPlDown().getConstraints()); ui.getAcPlDown().removeActionListener(this); ui.getAcPlDown().addActionListener(this); // Add menu add(ui.getAcPlAdd(), ui.getAcPlAdd().getConstraints()); ui.getAcPlAdd().removeActionListener(this); ui.getAcPlAdd().addActionListener(this); add(ui.getAcPlAddPopup(), ui.getAcPlAddPopup().getConstraints()); ui.getAcPlAddPopup().setVisible(false); ActiveJButton[] items = ui.getAcPlAddPopup().getItems(); for (int i = 0; i < items.length; i++) { items[i].addActionListener(this); } // Remove menu add(ui.getAcPlRemove(), ui.getAcPlRemove().getConstraints()); ui.getAcPlRemove().removeActionListener(this); ui.getAcPlRemove().addActionListener(this); add(ui.getAcPlRemovePopup(), ui.getAcPlRemovePopup().getConstraints()); ui.getAcPlRemovePopup().setVisible(false); items = ui.getAcPlRemovePopup().getItems(); for (int i = 0; i < items.length; i++) { items[i].removeActionListener(this); items[i].addActionListener(this); } // Select menu add(ui.getAcPlSelect(), ui.getAcPlSelect().getConstraints()); ui.getAcPlSelect().removeActionListener(this); ui.getAcPlSelect().addActionListener(this); add(ui.getAcPlSelectPopup(), ui.getAcPlSelectPopup().getConstraints()); ui.getAcPlSelectPopup().setVisible(false); items = ui.getAcPlSelectPopup().getItems(); for (int i = 0; i < items.length; i++) { items[i].removeActionListener(this); items[i].addActionListener(this); } // Misc menu add(ui.getAcPlMisc(), ui.getAcPlMisc().getConstraints()); ui.getAcPlMisc().removeActionListener(this); ui.getAcPlMisc().addActionListener(this); add(ui.getAcPlMiscPopup(), ui.getAcPlMiscPopup().getConstraints()); ui.getAcPlMiscPopup().setVisible(false); items = ui.getAcPlMiscPopup().getItems(); for (int i = 0; i < items.length; i++) { items[i].removeActionListener(this); items[i].addActionListener(this); } // List menu add(ui.getAcPlList(), ui.getAcPlList().getConstraints()); ui.getAcPlList().removeActionListener(this); ui.getAcPlList().addActionListener(this); add(ui.getAcPlListPopup(), ui.getAcPlListPopup().getConstraints()); ui.getAcPlListPopup().setVisible(false); items = ui.getAcPlListPopup().getItems(); for (int i = 0; i < items.length; i++) { items[i].removeActionListener(this); items[i].addActionListener(this); } // Popup menu fipopup = new JPopupMenu(); JMenuItem mi = new JMenuItem(ui.getResource("playlist.popup.info")); mi.setActionCommand(PlayerActionEvent.ACPLINFO); mi.removeActionListener(this); mi.addActionListener(this); fipopup.add(mi); fipopup.addSeparator(); mi = new JMenuItem(ui.getResource("playlist.popup.play")); mi.setActionCommand(PlayerActionEvent.ACPLPLAY); mi.removeActionListener(this); mi.addActionListener(this); fipopup.add(mi); fipopup.addSeparator(); mi = new JMenuItem(ui.getResource("playlist.popup.remove")); mi.setActionCommand(PlayerActionEvent.ACPLREMOVE); mi.removeActionListener(this); mi.addActionListener(this); fipopup.add(mi); validate(); repaint(); }
From source file:net.chaosserver.timelord.swingui.TimelordMenu.java
/** * Creates the file menu.//from w w w . j a v a 2 s . com * * @return the new file menu */ protected JMenu createFileMenu() { JMenu fileMenu = new JMenu(resourceBundle.getString(RROOT + ".fileMenuName")); JMenuItem menuItem; fileMenu.setMnemonic(KeyEvent.VK_F); JMenu exportMenu = new JMenu(resourceBundle.getString(RROOT + ".file.export")); exportMenu.setMnemonic(KeyEvent.VK_A); menuItem = new JMenuItem(resourceBundle.getString(RROOT + ".file.export.jordan"), KeyEvent.VK_J); menuItem.setToolTipText(resourceBundle.getString(RROOT + ".file.export.jordan.tooltip")); menuItem.setActionCommand(ACTION_EXPORT_JORDAN); menuItem.addActionListener(this); exportMenu.add(menuItem); menuItem = new JMenuItem(resourceBundle.getString(RROOT + ".file.export.doug"), KeyEvent.VK_D); menuItem.setToolTipText("For Losers"); menuItem.setActionCommand(ACTION_EXPORT_DOUG); menuItem.addActionListener(this); exportMenu.add(menuItem); exportMenu.addSeparator(); menuItem = new JMenuItem("XML...", KeyEvent.VK_X); menuItem.setActionCommand(ACTION_EXPORT_XML); menuItem.addActionListener(this); exportMenu.add(menuItem); fileMenu.add(exportMenu); if (!OsUtil.isMac()) { fileMenu.addSeparator(); menuItem = new JMenuItem("Exit", KeyEvent.VK_X); menuItem.setActionCommand(ACTION_EXIT); menuItem.addActionListener(this); fileMenu.add(menuItem); } return fileMenu; }
From source file:ucar.unidata.idv.control.chart.ChartHolder.java
/** * Add in the zoom menu items/* w ww .java 2 s .c om*/ * * @param items items */ private void addZoomMenuItems(List items) { JMenuItem mi; JMenu menu; items.add(menu = new JMenu("Zoom In")); menu.add(mi = new JMenuItem("All Axes")); mi.setActionCommand(ChartPanel.ZOOM_IN_BOTH_COMMAND); mi.addActionListener(chartPanel); menu.addSeparator(); menu.add(mi = new JMenuItem("Domain Axis")); mi.setActionCommand(ChartPanel.ZOOM_IN_DOMAIN_COMMAND); mi.addActionListener(chartPanel); menu.add(mi = new JMenuItem("Range Axis")); mi.setActionCommand(ChartPanel.ZOOM_IN_RANGE_COMMAND); mi.addActionListener(chartPanel); items.add(menu = new JMenu("Zoom Out")); menu.add(mi = new JMenuItem("All Axes")); mi.setActionCommand(ChartPanel.ZOOM_OUT_BOTH_COMMAND); mi.addActionListener(chartPanel); menu.addSeparator(); menu.add(mi = new JMenuItem("Domain Axis")); mi.setActionCommand(ChartPanel.ZOOM_OUT_DOMAIN_COMMAND); mi.addActionListener(chartPanel); menu.add(mi = new JMenuItem("Range Axis")); mi.setActionCommand(ChartPanel.ZOOM_OUT_RANGE_COMMAND); mi.addActionListener(chartPanel); items.add(menu = new JMenu("Auto Range")); menu.add(mi = new JMenuItem("All Axes")); mi.setActionCommand(ChartPanel.ZOOM_RESET_BOTH_COMMAND); mi.addActionListener(chartPanel); menu.addSeparator(); menu.add(mi = new JMenuItem("Domain Axis")); mi.setActionCommand(ChartPanel.ZOOM_RESET_DOMAIN_COMMAND); mi.addActionListener(chartPanel); menu.add(mi = new JMenuItem("Range Axis")); mi.setActionCommand(ChartPanel.ZOOM_RESET_RANGE_COMMAND); mi.addActionListener(chartPanel); }
From source file:com.evanbelcher.DrillBook.display.DBMenuBar.java
/** * Constructs DBMenuBar. Adds the menu and menuitems. * * @param graphicsRunner the JFrame that created this * @param desktop the DBDesktopPane in the JFrame *//*from w w w . j a va 2s. c o m*/ public DBMenuBar(GraphicsRunner graphicsRunner, DBDesktopPane desktop) { super(); gr = graphicsRunner; this.desktop = desktop; //Set up the menu JMenu menu = new JMenu("File"); add(menu); //Set up the menu items. JMenuItem menuItem = new JMenuItem("New"); menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("new"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Open"); menuItem.setMnemonic(KeyEvent.VK_O); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("open"); menuItem.addActionListener(this); menuItem.setLayout(new MigLayout()); menu.add(menuItem); menuItem = new JMenuItem("Save"); menuItem.setMnemonic(KeyEvent.VK_S); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("save"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Save As"); menuItem.setActionCommand("saveas"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Print Current Page"); menuItem.setMnemonic(KeyEvent.VK_P); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("printpage"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Print Show"); menuItem.setActionCommand("printshow"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Print Dot Sheets"); menuItem.setActionCommand("printdotsheets"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Quit"); menuItem.setMnemonic(KeyEvent.VK_Q); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("quit"); menuItem.addActionListener(this); menu.add(menuItem); menu = new JMenu("Edit"); add(menu); menuItem = new JMenuItem("Undo"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("undo"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Redo"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("redo"); menuItem.addActionListener(this); menu.add(menuItem); menu = new JMenu("Settings"); add(menu); menuItem = new JMenuItem("Toggle Gridlines"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("togglegrid"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldShowGrid() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem("Toggle Dot Names"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("togglenames"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldShowNames() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem("Toggle Text Box"); menuItem.setActionCommand("toggletext"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldShowText() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem("Color Code Dots by Instrument"); menuItem.setActionCommand("colordots"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldColorDots() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem(); menuItem.setText(Main.getState().getSettings().useCollegeHashes() ? "Change to High School Hashes" : "Change to College Hashes"); menuItem.setActionCommand("changehash"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Change Font Size"); menuItem.setActionCommand("fontsize"); menuItem.addActionListener(this); menu.add(menuItem); //add(Box.createHorizontalStrut(menu.getPreferredSize().width)); //add these to the menubar itself menuItem = new JMenuItem("Play"); menuItem.setMaximumSize(new Dimension(menuItem.getPreferredSize().width, Integer.MAX_VALUE)); menuItem.setActionCommand("play"); menuItem.addActionListener(this); add(menuItem); add(Box.createHorizontalGlue()); menu = new JMenu("Help"); add(menu); menuItem = new JMenuItem("Help"); menuItem.setActionCommand("help"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("About"); menuItem.setActionCommand("about"); menuItem.addActionListener(this); menu.add(menuItem); }
From source file:io.gameover.utilities.pixeleditor.Pixelizer.java
private JMenuBar getAppMenuBar() { if (this.appMenuBar == null) { this.appMenuBar = new JMenuBar(); JMenu menuOpen = new JMenu("File"); JMenuItem openMenu = new JMenuItem("Open..."); openMenu.setActionCommand(ACTION_OPEN); InternalActionListener actionListener = new InternalActionListener(this); openMenu.addActionListener(actionListener); menuOpen.add(openMenu);//from w w w .j av a2 s. com JMenuItem saveMenuAsPng = new JMenuItem("Save as PNG..."); saveMenuAsPng.setActionCommand(ACTION_SAVE_AS_PNG); saveMenuAsPng.addActionListener(actionListener); menuOpen.add(saveMenuAsPng); JMenuItem saveMenuAsGif = new JMenuItem("Save as GIF..."); saveMenuAsGif.setActionCommand(ACTION_SAVE_AS_GIF); saveMenuAsGif.addActionListener(actionListener); menuOpen.add(saveMenuAsGif); this.appMenuBar.add(menuOpen); JMenu menuEdit = new JMenu("Edit"); JMenuItem clearChangesMenu = new JMenuItem("Clear changes"); clearChangesMenu.setActionCommand(ACTION_CLEAR); clearChangesMenu.addActionListener(actionListener); menuEdit.add(clearChangesMenu); JMenuItem clearSelectionMenu = new JMenuItem("Clear selection"); clearSelectionMenu.setActionCommand(ACTION_CLEAR_SELECTION); clearSelectionMenu.addActionListener(actionListener); menuEdit.add(clearSelectionMenu); appMenuBar.add(menuEdit); } return appMenuBar; }
From source file:org.jfree.chart.demo.SuperDemo.java
private JMenuBar createMenuBar() { JMenuBar jmenubar = new JMenuBar(); JMenu jmenu = new JMenu("File", true); jmenu.setMnemonic('F'); JMenuItem jmenuitem = new JMenuItem("Export to PDF...", 112); jmenuitem.setActionCommand("EXPORT_TO_PDF"); jmenuitem.addActionListener(this); jmenu.add(jmenuitem);//from w w w . j av a 2 s .co m jmenu.addSeparator(); JMenuItem jmenuitem1 = new JMenuItem("Exit", 120); jmenuitem1.setActionCommand("EXIT"); jmenuitem1.addActionListener(this); jmenu.add(jmenuitem1); jmenubar.add(jmenu); return jmenubar; }
From source file:br.ufrgs.enq.jcosmo.ui.COSMOSACDialog.java
public COSMOSACDialog() { super("JCOSMO Simple"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new BorderLayout()); db = COSMOSACDataBase.getInstance(); COSMOSAC models[] = new COSMOSAC[5]; models[0] = new COSMOSAC(); models[1] = new COSMOPAC(); models[2] = new COSMOSAC_SVP(); models[3] = new COSMOSAC_G(); models[4] = new PCMSAC(); modelBox = new JComboBox(models); modelBox.addActionListener(this); JPanel north = new JPanel(new GridLayout(0, 2)); add(north, BorderLayout.NORTH); JPanel northAba1 = new JPanel(new GridLayout(0, 4)); JPanel northAba2 = new JPanel(new GridLayout(0, 2)); //Where the GUI is created: JMenuBar menuBar;/* w w w.ja va 2 s . c o m*/ JMenu file, help; JMenuItem menuItem; //Create the menu bar. menuBar = new JMenuBar(); // the file menu file = new JMenu("File"); file.setMnemonic(KeyEvent.VK_F); menuBar.add(file); menuItem = new JMenuItem("Quit", KeyEvent.VK_Q); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK)); menuItem.setActionCommand(QUIT); menuItem.addActionListener(this); file.add(menuItem); // the help menu help = new JMenu("Help"); file.setMnemonic(KeyEvent.VK_H); menuBar.add(help); menuItem = new JMenuItem("About", KeyEvent.VK_A); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); menuItem.setActionCommand(ABOUT); menuItem.addActionListener(this); help.add(menuItem); setJMenuBar(menuBar); listModel = new DefaultListModel(); list = new JList(listModel); list.setBorder(BorderFactory.createTitledBorder("compounds")); list.setVisibleRowCount(2); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane listScrollPane = new JScrollPane(list); JButton addButton = new JButton("Add"); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new AddCompoundDialog(COSMOSACDialog.this); } }); removeButton = new JButton("Remove"); removeButton.addActionListener(this); visibRemove(false); JButton calcButton = new JButton("Calculate"); calcButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rebuildChart(); rebuildSigmaProfiles(); } }); JButton refreshButton = new JButton("Refresh"); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rebuildSigmaProfiles(); } }); ignoreSGButton = new JCheckBox("Ignore SG"); ignoreSGButton.setToolTipText("Toogles the ignore flag for the Staverman-Guggenheim term"); ignoreSGButton.addActionListener(this); JPanel but = new JPanel(new GridLayout(0, 1)); but.add(addButton, BorderLayout.EAST); but.add(removeButton, BorderLayout.EAST); but.add(modelBox); north.add(listScrollPane); north.add(but); northAba1.add(new JLabel("Temperature [K]")); northAba1.add(temperature = new JTextField(10)); temperature.setText("298"); northAba1.add(new JLabel("Sigma HB")); northAba1.add(sigmaHB = new JTextField(10)); northAba1.add(new JLabel("Sigma HB2")); northAba1.add(sigmaHB2 = new JTextField(10)); northAba1.add(new JLabel("Sigma HB3")); northAba1.add(sigmaHB3 = new JTextField(10)); northAba1.add(new JLabel("Charge HB")); northAba1.add(chargeHB = new JTextField(10)); northAba1.add(new JLabel("Sigma Disp")); northAba1.add(sigmaDisp = new JTextField(10)); northAba1.add(new JLabel("Charge Disp")); northAba1.add(chargeDisp = new JTextField(10)); northAba1.add(new JLabel("Beta")); northAba1.add(beta = new JTextField(10)); northAba1.add(new JLabel("fpol")); northAba1.add(fpol = new JTextField(10)); northAba1.add(new JLabel("Anorm")); northAba1.add(anorm = new JTextField(10)); northAba1.add(ignoreSGButton); northAba1.add(calcButton); northAba2.add(new JLabel("")); northAba2.add(refreshButton); // chart = new JLineChart(); // add(chart, BorderLayout.CENTER); // chart.setTitle("Gamma Plot"); // chart.setSubtitle(""); // chart.setXAxisLabel("Mole Fraction, x_1"); // chart.setYAxisLabel("ln gamma, gE/RT"); // chart.setSource(getTitle()); // chart.setLegendPosition(LegendPosition.BOTTOM); // chart.setShapesVisible(true); JFreeChart chart = ChartFactory.createXYLineChart(null, "Mole Fraction, x_1", "ln gamma, gE/RT", null, PlotOrientation.VERTICAL, true, true, false); plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setAutoRange(false); plot.getDomainAxis().setRange(new Range(0.0, 1.0)); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer(); r.setUseFillPaint(true); r.setBaseFillPaint(Color.white); r.setBaseShapesVisible(true); JFreeChart sigmaProfileChart = ChartFactory.createXYLineChart(null, "sigma", "P^x", null, PlotOrientation.VERTICAL, true, true, false); sigmaProfilePlot = sigmaProfileChart.getXYPlot(); sigmaProfilePlot.getDomainAxis().setAutoRange(false); sigmaProfilePlot.getDomainAxis().setRange(new Range(-0.025, 0.025)); // sigmaProfilePlot.setBackgroundPaint(Color.lightGray); // sigmaProfilePlot.setDomainGridlinePaint(Color.white); // sigmaProfilePlot.setRangeGridlinePaint(Color.white); JFreeChart chartSegGamma = ChartFactory.createXYLineChart(null, "sigma", "Segment Gamma", null, PlotOrientation.VERTICAL, true, true, false); plotSegGamma = (XYPlot) chartSegGamma.getPlot(); JPanel south = new JPanel(); south.setLayout(new FlowLayout()); south.add(new JLabel("<html>ln γ<sup>∞</sup><sub>1</sub>:</html>")); south.add(lnGammaInf1Label = new JLabel()); south.add(new JLabel("<html>ln γ<sup>∞</sup><sub>2</sub>:</html>")); south.add(lnGammaInf2Label = new JLabel()); south.add(Box.createHorizontalStrut(20)); south.add(new JLabel("<html>γ<sup>∞</sup><sub>1</sub>:</html>")); south.add(gammaInf1Label = new JLabel()); south.add(new JLabel("<html>γ<sup>∞</sup><sub>2</sub>:</html>")); south.add(gammaInf2Label = new JLabel()); JPanel aba1 = new JPanel(new BorderLayout()); aba1.add(northAba1, BorderLayout.NORTH); JPanel chartsPanel = new JPanel(new GridLayout(0, 2)); aba1.add(chartsPanel, BorderLayout.CENTER); chartsPanel.add(new ChartPanel(chart)); chartsPanel.add(new ChartPanel(chartSegGamma)); aba1.add(south, BorderLayout.SOUTH); JPanel aba2 = new JPanel(new BorderLayout()); aba2.add(northAba2, BorderLayout.NORTH); aba2.add(chartPanel = new ChartPanel(sigmaProfileChart), BorderLayout.CENTER); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("gamma", aba1); tabbedPane.addTab("sigma", aba2); add(tabbedPane, BorderLayout.CENTER); // cosmosac.setAEffPrime(6.596176570595075); // cosmosac.setCoord(11.614599507917934); // cosmosac.setVnorm(56.36966406129967); // cosmosac.setAnorm(41.56058649432742); // cosmosac.setCHB(65330.19484947528); // cosmosac.setSigmaHB(0.008292411048046008); //Display the window. setSize(800, 600); setLocationRelativeTo(null); modelBox.setSelectedIndex(0); setVisible(true); // test for a mixture // addList("WATER"); // addList("H3O+1"); // addList("OH-1"); // addList("CL-1"); // addList("OXYGEN"); // addList("sec-butylamine"); // addList("hydrogen-fluoride"); // addList("ACETONE"); // addList("METHANOL"); // addList("ACETONE.opt"); // addList("METHANOL.opt"); // addList("METHYL-ETHYL-KETONE"); // addList("ETHANOL"); // addList("N-HEPTANE"); // addList("PROPIONIC-ACID"); // addList("EMIM"); // addList("NTF2"); // addList("DCA"); // addList("N-OCTANE"); addList("ETHYLENE CARBONATE"); addList("BENZENE"); addList("TOLUENE"); removeButton.setEnabled(true); }
From source file:org.gumtree.vis.awt.time.TimePlotPanel.java
@Override protected void displayPopupMenu(int x, int y) { LegendTitle legend = getChart().getLegend(); if (legend != null) { boolean isVisable = legend.isVisible(); RectangleEdge location = legend.getPosition(); if (isVisable) { if (location.equals(RectangleEdge.BOTTOM)) { legendBottom.setSelected(true); legendNone.setSelected(false); legendRight.setSelected(false); } else if (isVisable && location.equals(RectangleEdge.RIGHT)) { legendRight.setSelected(true); legendNone.setSelected(false); legendBottom.setSelected(false); }/*from w ww .j av a 2s .c om*/ } else { legendNone.setSelected(true); legendRight.setSelected(false); legendBottom.setSelected(false); } } curveManagementMenu.removeAll(); curveResetMenu.removeAll(); if (getXYPlot().getDatasetCount() > 0) { curveManagementMenu.setEnabled(true); curveResetMenu.setEnabled(true); JMenuItem focusNoneCurveItem = new JRadioButtonMenuItem(); focusNoneCurveItem.setText("None"); focusNoneCurveItem.setActionCommand(UNFOCUS_CURVE_COMMAND); focusNoneCurveItem.addActionListener(this); curveManagementMenu.add(focusNoneCurveItem); JMenuItem resetAllCurveItem = new JMenuItem(); resetAllCurveItem.setText("RESET ALL"); resetAllCurveItem.setActionCommand(RESET_ALL_CURVE_COMMAND); resetAllCurveItem.addActionListener(this); curveResetMenu.add(resetAllCurveItem); boolean isCurveFocused = false; for (int j = 0; j < getXYPlot().getDatasetCount(); j++) { XYDataset dataset = getChart().getXYPlot().getDataset(j); if (dataset != null) { for (int i = 0; i < dataset.getSeriesCount(); i++) { String seriesKey = (String) dataset.getSeriesKey(i); JMenuItem focusOnCurveItem = new JRadioButtonMenuItem(); focusOnCurveItem.setText(seriesKey); focusOnCurveItem.setActionCommand(FOCUS_ON_COMMAND + "-" + seriesKey); focusOnCurveItem.addActionListener(this); curveManagementMenu.add(focusOnCurveItem); if (dataset == selectedDataset && i == selectedSeriesIndex) { focusOnCurveItem.setSelected(true); isCurveFocused = true; } JMenuItem resetCurveItem = new JMenuItem(); resetCurveItem.setText("Reset " + seriesKey); resetCurveItem.setActionCommand(RESET_CURVE_COMMAND + "-" + seriesKey); resetCurveItem.addActionListener(this); curveResetMenu.add(resetCurveItem); } } } if (!isCurveFocused) { focusNoneCurveItem.setSelected(true); } } else { curveManagementMenu.setEnabled(false); curveResetMenu.setEnabled(false); } showMultiAxesMenuItem.setSelected(isShowMultiaxes()); if (isPaused) { pauseMenuItem.setText("Paused"); } else { pauseMenuItem.setText("Click to Pause"); } pauseMenuItem.setSelected(isPaused); super.displayPopupMenu(x, y); }
From source file:org.gvsig.remotesensing.scatterplot.chart.ScatterPlotDiagram.java
/** * Creates a popup menu for the panel.//from w ww . ja va 2s .com * * @param properties include a menu item for the chart property editor. * @param save include a menu item for saving the chart. * @param print include a menu item for printing the chart. * @param zoom include menu items for zooming. * * @return The popup menu. */ protected JPopupMenu createPopupMenu(boolean properties, boolean save, boolean print, boolean zoom) { JPopupMenu result = new JPopupMenu("Chart:"); boolean separator = false; JMenuItem newClassItem = new JMenuItem(PluginServices.getText(this, "new_class")); newClassItem.setActionCommand(NEW_CLASS_COMMAND); newClassItem.addActionListener(this); result.add(newClassItem); separator = true; if (properties) { } if (save) { if (separator) { result.addSeparator(); separator = false; } JMenuItem saveItem = new JMenuItem(localizationResources.getString("Save_as...")); saveItem.setActionCommand(SAVE_COMMAND); saveItem.addActionListener(this); result.add(saveItem); separator = true; } if (print) { if (separator) { result.addSeparator(); separator = false; } JMenuItem printItem = new JMenuItem(localizationResources.getString("Print...")); printItem.setActionCommand(PRINT_COMMAND); printItem.addActionListener(this); result.add(printItem); separator = true; } if (zoom) { if (separator) { result.addSeparator(); separator = false; } } return result; }
From source file:net.chaosserver.timelord.swingui.TimelordMenu.java
/** * Creates a new instance of the help menu. * * @return the new help menu// w w w . j a v a2 s . co m */ protected JMenu createHelpMenu() { JMenuItem menuItem; JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic(KeyEvent.VK_H); this.add(helpMenu); menuItem = new JMenuItem("Help Topics", KeyEvent.VK_H); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_H, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); try { URL hsURL = HelpSet.findHelpSet(this.getClass().getClassLoader(), "net/chaosserver/timelord/help/TimelordHelp.hs"); HelpSet hs = new HelpSet(null, hsURL); HelpBroker hb = hs.createHelpBroker(); menuItem.addActionListener(new CSH.DisplayHelpFromSource(hb)); } catch (HelpSetException e) { menuItem.setEnabled(false); } // menuItem.setActionCommand(ACTION_ABOUT); helpMenu.add(menuItem); menuItem = new JMenuItem("Log Window"); menuItem.setActionCommand(ACTION_LOG); menuItem.addActionListener(this); menuItem.setEnabled(false); helpMenu.add(menuItem); menuItem = new JMenuItem("Cause Memory Leak"); menuItem.setActionCommand(ACTION_LEAK); menuItem.addActionListener(this); menuItem.setEnabled(false); helpMenu.add(menuItem); if (!OsUtil.isMac()) { helpMenu.addSeparator(); menuItem = new JMenuItem("About Timelord", KeyEvent.VK_A); menuItem.setActionCommand(ACTION_ABOUT); menuItem.addActionListener(this); helpMenu.add(menuItem); } return helpMenu; }