List of usage examples for javax.swing JMenu add
public JMenuItem add(Action a)
From source file:ucar.unidata.idv.control.chart.ChartManager.java
/** * add menu items/* w ww. j a va 2 s . c o m*/ * * @param items items */ public void addViewMenuItems(List items) { JMenu layoutMenu = new JMenu("Layout"); items.add(layoutMenu); JMenuItem mi; int[] types = { LAYOUT_GRAPH, LAYOUT_VSTACK, LAYOUT_HSTACK, LAYOUT_2COLGRID, LAYOUT_3COLGRID, LAYOUT_TAB }; String[] names = { "Grid", "Vertical", "Horizontal", "2 Columns", "3 Columns", "Tabs" }; layoutMenu.add(mi = GuiUtils.makeMenuItem("Change Grid Layout", this, "editLayout")); layoutMenu.addSeparator(); mi.setEnabled(layout == LAYOUT_GRAPH); for (int i = 0; i < types.length; i++) { layoutMenu.add(mi = GuiUtils.makeMenuItem(names[i], this, "setLayoutType", new Integer(types[i]))); if (types[i] == layout) { mi.setEnabled(false); } } items.add(GuiUtils.MENU_SEPARATOR); for (ChartHolder chartHolder : chartHolders) { if (!chartHolder.getBeingShown()) { continue; } List chartItems = new ArrayList(); chartHolder.getMenuItems(chartItems); items.add(GuiUtils.makeMenu("Chart: " + chartHolder.getName(), chartItems)); } }
From source file:edu.clemson.cs.nestbed.client.gui.NetworkMonitorFrame.java
private final JMenu buildNetworkMenu() { final JMenu menu = new JMenu("Network"); final JMenuItem install = new JMenuItem("Install Programs"); final JMenuItem vizMenu = new JMenuItem("Visualizations"); install.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new Thread() { public void run() { try { install.setEnabled(false); progDeployMgr.deployConfiguration(config.getID()); } catch (Exception ex) { log.error("Exception occured while installing " + "programs.", ex); ClientUtils.displayErrorMessage(NetworkMonitorFrame.this, ex); } finally { install.setEnabled(true); }//w ww.ja v a 2 s .c om } }.start(); } }); menu.add(install); menu.add(new JSeparator()); vizMenu.addActionListener(new VisualizationMenuListener()); menu.add(vizMenu); return menu; }
From source file:com.limegroup.gnutella.gui.library.LibraryTableMediator.java
private JMenu createSearchSubMenu(LibraryTableDataLine dl) { JMenu menu = new JMenu(GUIMediator.getStringResource("LIBRARY_TABLE_SEARCH_POPUP_MENU")); if (dl != null) { File f = (File) dl.getInitializeObject(); String keywords = StringUtils.createQueryString(f.getName()); if (keywords.length() > 2) menu.add(new JMenuItem(new SearchAction(keywords))); LimeXMLDocument doc = dl.getXMLDocument(); if (doc != null) { Action[] actions = ActionUtils.createSearchActions(doc); for (int i = 0; i < actions.length; i++) menu.add(new JMenuItem(actions[i])); }/* w w w .java 2 s . co m*/ } if (menu.getItemCount() == 0) menu.setEnabled(false); return menu; }
From source file:com.declarativa.interprolog.gui.ListenerWindow.java
static void addItemToMenu(JMenu menu, String item, char mnemonics, ActionListener handler) { JMenuItem menuItem = new JMenuItem(item); menuItem.setMnemonic(mnemonics);//w w w . ja v a 2s. co m menu.add(menuItem); menuItem.addActionListener(handler); }
From source file:gdt.jgui.entity.JEntityStructurePanel.java
/** * Get the context menu./*from w w w .ja v a2s . c o m*/ * @return the context menu. */ @Override public JMenu getContextMenu() { JMenu menu = new JMenu("Context"); menu.setName("Context"); JMenuItem facetItem = new JMenuItem("Facets"); facetItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Properties locator = Locator.toProperties(locator$); String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); JEntityFacetPanel efp = new JEntityFacetPanel(); String efpLocator$ = efp.getLocator(); efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$); efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entityKey$); JConsoleHandler.execute(console, efpLocator$); } }); menu.add(facetItem); JMenuItem digestItem = new JMenuItem("Digest"); digestItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Properties locator = Locator.toProperties(locator$); String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); JEntityDigestDisplay edp = new JEntityDigestDisplay(); String edpLocator$ = edp.getLocator(); edpLocator$ = Locator.append(edpLocator$, Entigrator.ENTIHOME, entihome$); edpLocator$ = Locator.append(edpLocator$, EntityHandler.ENTITY_KEY, entityKey$); JConsoleHandler.execute(console, edpLocator$); } }); menu.add(digestItem); return menu; }
From source file:net.sf.firemox.DeckBuilder.java
/** * Creates new form DeckBuilder//from ww w . j a v a 2 s . com */ private DeckBuilder() { super("DeckBuilder"); form = this; timerPanel = new TimerGlassPane(); cardLoader = new CardLoader(timerPanel); timer = new Timer(200, cardLoader); setGlassPane(timerPanel); try { setIconImage(Picture.loadImage(IdConst.IMAGES_DIR + "deckbuilder.gif")); } catch (Exception e) { // IGNORING } // Load settings loadSettings(); // Initialize components final JMenuItem newItem = UIHelper.buildMenu("menu_db_new", 'n', this); newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK)); final JMenuItem loadItem = UIHelper.buildMenu("menu_db_load", 'o', this); loadItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); final JMenuItem saveAsItem = UIHelper.buildMenu("menu_db_saveas", 'a', this); saveAsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0)); final JMenuItem saveItem = UIHelper.buildMenu("menu_db_save", 's', this); saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK)); final JMenuItem quitItem = UIHelper.buildMenu("menu_db_exit", this); quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK)); final JMenuItem deckConstraintsItem = UIHelper.buildMenu("menu_db_constraints", 'c', this); deckConstraintsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0)); final JMenuItem aboutItem = UIHelper.buildMenu("menu_help_about", 'a', this); aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, InputEvent.SHIFT_MASK)); final JMenuItem convertDCK = UIHelper.buildMenu("menu_convert_DCK_MP", this); final JMenu mainMenu = UIHelper.buildMenu("menu_file"); mainMenu.add(newItem); mainMenu.add(loadItem); mainMenu.add(saveAsItem); mainMenu.add(saveItem); mainMenu.add(new JSeparator()); mainMenu.add(quitItem); super.optionMenu = new JMenu("Options"); final JMenu convertMenu = UIHelper.buildMenu("menu_convert"); convertMenu.add(convertDCK); final JMenuItem helpItem = UIHelper.buildMenu("menu_help_help", 'h', this); helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); final JMenu helpMenu = new JMenu("?"); helpMenu.add(helpItem); helpMenu.add(deckConstraintsItem); helpMenu.add(aboutItem); final JMenuBar menuBar = new JMenuBar(); menuBar.add(mainMenu); initAbstractMenu(); menuBar.add(optionMenu); menuBar.add(convertMenu); menuBar.add(helpMenu); setJMenuBar(menuBar); addWindowListener(this); // Build the panel containing amount of available cards final JLabel amountLeft = new JLabel("<html>0/?", SwingConstants.RIGHT); // Build the left list allListModel = new MListModel<MCardCompare>(amountLeft, false); leftList = new ThreadSafeJList(allListModel); leftList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); leftList.setLayoutOrientation(JList.VERTICAL); leftList.getSelectionModel().addListSelectionListener(this); leftList.addMouseListener(this); leftList.setVisibleRowCount(10); // Initialize the text field containing the amount to add addQtyTxt = new JTextField("1"); // Build the "Add" button addButton = new JButton(LanguageManager.getString("db_add")); addButton.setMnemonic('a'); addButton.setEnabled(false); // Build the panel containing : "Add" amount and "Add" button final Box addPanel = Box.createHorizontalBox(); addPanel.add(addButton); addPanel.add(addQtyTxt); addPanel.setMaximumSize(new Dimension(32010, 26)); // Build the panel containing the selected card name cardNameTxt = new JTextField(); new HireListener(cardNameTxt, addButton, this, leftList); final JLabel searchLabel = new JLabel(LanguageManager.getString("db_search") + " : "); searchLabel.setLabelFor(cardNameTxt); // Build the panel containing search label and card name text field final Box searchPanel = Box.createHorizontalBox(); searchPanel.add(searchLabel); searchPanel.add(cardNameTxt); searchPanel.setMaximumSize(new Dimension(32010, 26)); listScrollerLeft = new JScrollPane(leftList); MToolKit.addOverlay(listScrollerLeft); // Build the left panel containing : list, available amount, "Add" panel final JPanel srcPanel = new JPanel(null); srcPanel.add(searchPanel); srcPanel.add(listScrollerLeft); srcPanel.add(amountLeft); srcPanel.add(addPanel); srcPanel.setMinimumSize(new Dimension(220, 200)); srcPanel.setLayout(new BoxLayout(srcPanel, BoxLayout.Y_AXIS)); // Initialize constraints constraintsChecker = new ConstraintsChecker(); constraintsChecker.setBorder(new EtchedBorder()); final JScrollPane constraintsCheckerScroll = new JScrollPane(constraintsChecker); MToolKit.addOverlay(constraintsCheckerScroll); // create a pane with the oracle text for the present card oracleText = new JLabel(); oracleText.setPreferredSize(new Dimension(180, 200)); oracleText.setVerticalAlignment(SwingConstants.TOP); final JScrollPane oracle = new JScrollPane(oracleText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); MToolKit.addOverlay(oracle); // build some Pie Charts and a panel to display it initSets(); datasets = new ChartSets(); final JTabbedPane tabbedPane = new JTabbedPane(); for (ChartFilter filter : ChartFilter.values()) { final Dataset dataSet = filter.createDataSet(this); final JFreeChart chart = new JFreeChart(null, null, filter.createPlot(dataSet, painterMapper.get(filter)), false); datasets.addDataSet(filter, dataSet); ChartPanel pieChartPanel = new ChartPanel(chart, true); tabbedPane.add(pieChartPanel, filter.getTitle()); } // add the Constraints scroll panel and Oracle text Pane to the tabbedPane tabbedPane.add(constraintsCheckerScroll, LanguageManager.getString("db_constraints")); tabbedPane.add(oracle, LanguageManager.getString("db_text")); tabbedPane.setSelectedComponent(oracle); // The toollBar for color filtering toolBar = new JToolBar(); toolBar.setFloatable(false); final JButton clearButton = UIHelper.buildButton("clear"); clearButton.addActionListener(this); toolBar.add(clearButton); final JToggleButton toggleColorlessButton = new JToggleButton( UIHelper.getTbsIcon("mana/colorless/small/" + MdbLoader.unknownSmlMana), true); toggleColorlessButton.setActionCommand("0"); toggleColorlessButton.addActionListener(this); toolBar.add(toggleColorlessButton); for (int index = 1; index < IdCardColors.CARD_COLOR_NAMES.length; index++) { final JToggleButton toggleButton = new JToggleButton( UIHelper.getTbsIcon("mana/colored/small/" + MdbLoader.coloredSmlManas[index]), true); toggleButton.setActionCommand(String.valueOf(index)); toggleButton.addActionListener(this); toolBar.add(toggleButton); } // sorted card type combobox creation final List<String> idCards = new ArrayList<String>(Arrays.asList(CardFactory.exportedIdCardNames)); Collections.sort(idCards); final Object[] cardTypes = ArrayUtils.addAll(new String[] { LanguageManager.getString("db_types.any") }, idCards.toArray()); idCardComboBox = new JComboBox(cardTypes); idCardComboBox.setSelectedIndex(0); idCardComboBox.addActionListener(this); idCardComboBox.setActionCommand("cardTypeFilter"); // sorted card properties combobox creation final List<String> properties = new ArrayList<String>( CardFactory.getPropertiesName(DeckConstraints.getMinProperty(), DeckConstraints.getMaxProperty())); Collections.sort(properties); final Object[] cardProperties = ArrayUtils .addAll(new String[] { LanguageManager.getString("db_properties.any") }, properties.toArray()); propertiesComboBox = new JComboBox(cardProperties); propertiesComboBox.setSelectedIndex(0); propertiesComboBox.addActionListener(this); propertiesComboBox.setActionCommand("propertyFilter"); final JLabel colors = new JLabel(" " + LanguageManager.getString("colors") + " : "); final JLabel types = new JLabel(" " + LanguageManager.getString("types") + " : "); final JLabel property = new JLabel(" " + LanguageManager.getString("properties") + " : "); // filter Panel with colors toolBar and card type combobox final Box filterPanel = Box.createHorizontalBox(); filterPanel.add(colors); filterPanel.add(toolBar); filterPanel.add(types); filterPanel.add(idCardComboBox); filterPanel.add(property); filterPanel.add(propertiesComboBox); getContentPane().add(filterPanel, BorderLayout.NORTH); // Destination section : // Build the panel containing amount of available cards final JLabel rightAmount = new JLabel("0/?", SwingConstants.RIGHT); rightAmount.setMaximumSize(new Dimension(220, 26)); // Build the right list rightListModel = new MCardTableModel(new MListModel<MCardCompare>(rightAmount, true)); rightListModel.addTableModelListener(this); rightList = new JTable(rightListModel); rightList.setShowGrid(false); rightList.setTableHeader(null); rightList.getSelectionModel().addListSelectionListener(this); rightList.getColumnModel().getColumn(0).setMaxWidth(25); rightList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); // Build the panel containing the selected deck deckNameTxt = new JTextField("loading..."); deckNameTxt.setEditable(false); deckNameTxt.setBorder(null); final JLabel deckLabel = new JLabel(LanguageManager.getString("db_deck") + " : "); deckLabel.setLabelFor(deckNameTxt); final Box deckNamePanel = Box.createHorizontalBox(); deckNamePanel.add(deckLabel); deckNamePanel.add(deckNameTxt); deckNamePanel.setMaximumSize(new Dimension(220, 26)); // Initialize the text field containing the amount to remove removeQtyTxt = new JTextField("1"); // Build the "Remove" button removeButton = new JButton(LanguageManager.getString("db_remove")); removeButton.setMnemonic('r'); removeButton.addMouseListener(this); removeButton.setEnabled(false); // Build the panel containing : "Remove" amount and "Remove" button final Box removePanel = Box.createHorizontalBox(); removePanel.add(removeButton); removePanel.add(removeQtyTxt); removePanel.setMaximumSize(new Dimension(220, 26)); // Build the right panel containing : list, available amount, constraints final JScrollPane deskListScroller = new JScrollPane(rightList); MToolKit.addOverlay(deskListScroller); deskListScroller.setBorder(BorderFactory.createLineBorder(Color.GRAY)); deskListScroller.setMinimumSize(new Dimension(220, 200)); deskListScroller.setMaximumSize(new Dimension(220, 32000)); final Box destPanel = Box.createVerticalBox(); destPanel.add(deckNamePanel); destPanel.add(deskListScroller); destPanel.add(rightAmount); destPanel.add(removePanel); destPanel.setMinimumSize(new Dimension(220, 200)); destPanel.setMaximumSize(new Dimension(220, 32000)); // Build the panel containing the name of card in picture cardPictureNameTxt = new JLabel("<html><i>no selected card</i>"); final Box cardPictureNamePanel = Box.createHorizontalBox(); cardPictureNamePanel.add(cardPictureNameTxt); cardPictureNamePanel.setMaximumSize(new Dimension(32010, 26)); // Group the detail panels final JPanel viewCard = new JPanel(null); viewCard.add(cardPictureNamePanel); viewCard.add(CardView.getInstance()); viewCard.add(tabbedPane); viewCard.setLayout(new BoxLayout(viewCard, BoxLayout.Y_AXIS)); final Box mainPanel = Box.createHorizontalBox(); mainPanel.add(destPanel); mainPanel.add(viewCard); // Add the main panel getContentPane().add(srcPanel, BorderLayout.WEST); getContentPane().add(mainPanel, BorderLayout.CENTER); // Size this frame getRootPane().setPreferredSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT)); getRootPane().setMinimumSize(getRootPane().getPreferredSize()); pack(); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.navegacao_cego.PainelSimuladorNavegacao.java
/** * Cria o menu editar do Frame Principal * /* w w w . j av a2s .com*/ * @param menu */ private JMenu criaMenuEditar() { JMenu menu = new JMenu(GERAL.EDITAR); menu.setBackground(parentFrame.corDefault); menu.setMnemonic('E'); menu.setMnemonic(KeyEvent.VK_E); JMenuItem btnContraste = new JMenuItem(GERAL.BTN_ALTERAR_CONTRASTE); btnContraste.addActionListener(this); btnContraste.setActionCommand("Contraste"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); // btnAumenta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, // ActionEvent.CTRL_MASK)); btnContraste.setToolTipText(GERAL.ALTERAR_CONTRASTE); btnContraste.getAccessibleContext().setAccessibleDescription(GERAL.ALTERAR_CONTRASTE); menu.add(btnContraste); JMenuItem btnAumenta = new JMenuItem(GERAL.AUMENTA_FONTE); btnAumenta.addActionListener(this); btnAumenta.setActionCommand("AumentaFonte"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); btnAumenta.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, ActionEvent.CTRL_MASK)); btnAumenta.setToolTipText(GERAL.DICA_AUMENTA_FONTE); btnAumenta.getAccessibleContext().setAccessibleDescription(GERAL.DICA_AUMENTA_FONTE); menu.add(btnAumenta); JMenuItem btnDiminui = new JMenuItem(GERAL.DIMINUI_FONTE); btnDiminui.addActionListener(this); btnDiminui.setActionCommand("DiminuiFonte"); // btnDiminui.setMnemonic('F'); // btnDiminui.setMnemonic(KeyEvent.VK_F); btnDiminui.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SUBTRACT, ActionEvent.CTRL_MASK)); btnDiminui.setToolTipText(GERAL.DICA_DIMINUI_FONTE); btnDiminui.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DIMINUI_FONTE); menu.add(btnDiminui); JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO); btnSelecionarTudo.addActionListener(this); btnSelecionarTudo.setActionCommand("SelecionarTudo"); btnSelecionarTudo.setMnemonic('T'); btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); btnSelecionarTudo.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, ActionEvent.CTRL_MASK)); btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TUDO); btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TUDO); menu.add(btnSelecionarTudo); menu.add(new JSeparator()); /* * JMenuItem btnProcurar = new JMenuItem(GERAL.PROCURAR); * btnProcurar.addActionListener(this); * btnProcurar.setActionCommand("Procurar"); * btnProcurar.setMnemonic('P'); btnProcurar.setMnemonic(KeyEvent.VK_P); * btnProcurar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, * ActionEvent.CTRL_MASK)); * btnProcurar.setToolTipText(GERAL.DICA_PROCURAR); * btnProcurar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_PROCURAR); * menu.add(btnProcurar); * * JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO); * btnSelecionarTudo.addActionListener(this); * btnSelecionarTudo.setActionCommand("SelecionarTudo"); * btnSelecionarTudo.setMnemonic('T'); * btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); * btnSelecionarTudo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, * ActionEvent.CTRL_MASK)); * btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TUDO); * btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TUDO); * menu.add(btnSelecionarTudo); * * JMenuItem btnDesfazer = new JMenuItem(GERAL.DESFAZER); * btnDesfazer.addActionListener(this); * btnDesfazer.setActionCommand("Desfazer"); * btnDesfazer.setMnemonic('z'); btnDesfazer.setMnemonic(KeyEvent.VK_Z); * btnDesfazer.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DESFAZER); * btnDesfazer.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, * ActionEvent.CTRL_MASK)); menu.add(btnDesfazer); * menu.setEnabled(true); */ return menu; }
From source file:com.diversityarrays.kdxplore.KDXploreFrame.java
private JMenu createHelpMenu() { JMenu helpMenu = new JMenu(Msg.MENU_HELP()); helpMenu.add(aboutAction); if (Desktop.isDesktopSupported()) { helpMenu.add(onlineHelpAction);// ww w . ja v a 2 s . c o m helpMenu.add(new ReportIssueAction(this)); } return helpMenu; }
From source file:com.diversityarrays.kdxplore.KDXploreFrame.java
private JMenu createMainMenu(RunMode runMode) { JMenu mainMenu = new JMenu(Msg.MENU_FILE()); mainMenu.add(connectDisconnectActions.connectAction); mainMenu.add(connectDisconnectActions.disconnectAction); mainMenu.addSeparator();/*from w ww . jav a 2 s . c om*/ KDClientUtils.initAction(ImageId.SETTINGS_24, settingsAction, Msg.TOOLTIP_CHANGE_PREFS(), true); mainMenu.add(settingsAction); mainMenu.addSeparator(); mainMenu.add(updateAction); mainMenu.addSeparator(); mainMenu.add(exitAction); return mainMenu; }
From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java
/** * Set up the Menu bar using actions wherever possible. *//*w w w . j av a 2s . co m*/ private void initMenu() { JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnFile = new JMenu("File"); menuBar.add(mnFile); JMenuItem mntmOpen = new JMenuItem(this.actionBrowse); mntmOpen.setText("Open..."); mnFile.add(mntmOpen); JMenu mnSave = new JMenu("Save..."); mnFile.add(mnSave); JMenuItem mntmSaveTable = new JMenuItem(this.actionSaveTable); mnSave.add(mntmSaveTable); JMenuItem mntmSaveChartPDF = new JMenuItem(this.actionExportPDF); mnSave.add(mntmSaveChartPDF); JMenuItem mntmSaveChartPNG = new JMenuItem(this.actionExportPNG); mnSave.add(mntmSaveChartPNG); mnFile.addSeparator(); JMenuItem mntmExit = new JMenuItem(this.actionClose); mnFile.add(mntmExit); }