List of usage examples for javax.swing JMenu addSeparator
public void addSeparator()
From source file:no.java.ems.client.swing.EmsClient.java
private JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu(); fileMenu.setName("menus.file"); fileMenu.add(new DelegatingAction("new", tabs)); fileMenu.addSeparator(); fileMenu.add(new DelegatingAction("open", tabs)); fileMenu.addSeparator();/*from w ww .j a va 2s .c o m*/ fileMenu.add(new DelegatingAction("refresh", tabs)); fileMenu.addSeparator(); fileMenu.add(new CloseTabAction()); fileMenu.addSeparator(); fileMenu.add(saveAction); fileMenu.addSeparator(); fileMenu.add(logInAction); fileMenu.add(logOutAction); if (!SystemUtils.IS_OS_MAC) { fileMenu.addSeparator(); fileMenu.add(exitAction); } menuBar.add(fileMenu); JMenu editMenu = new JMenu(); editMenu.setName("menus.edit"); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(new DelegatingAction("cut", tabs)); editMenu.add(new DelegatingAction("copy", tabs)); editMenu.add(new DelegatingAction("paste", tabs)); editMenu.add(new DelegatingAction("delete", tabs)); editMenu.addSeparator(); editMenu.add(new DelegatingAction("addTags", tabs)); editMenu.add(new DelegatingAction("replaceTags", tabs)); editMenu.add(new DelegatingAction("addKeywords", tabs)); editMenu.add(new DelegatingAction("replaceKeywords", tabs)); menuBar.add(editMenu); if (SystemUtils.IS_OS_MAC) { for (int index = 0; index < menuBar.getMenuCount(); index++) { removeIcons(menuBar.getMenu(index)); } } return menuBar; }
From source file:nz.ac.massey.cs.gql4jung.browser.ResultBrowser.java
private void initMenubar() { menuBar = new JMenuBar(); this.setJMenuBar(menuBar); JMenu menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); menu.add(actLoadData);//w ww . ja v a 2 s .c o m menu.add(actLoadQuery); if (this.actLoadBuiltInQueries.size() > 0) { JMenu menu2 = new JMenu("Built-in queries"); for (Action act : actLoadBuiltInQueries) { menu2.add(act); } menu.add(menu2); } menu.addSeparator(); menu.add(actExport2CSV); menu.addSeparator(); menu.add(actExit); menuBar.add(menu); menu = new JMenu("Query"); menu.setMnemonic(KeyEvent.VK_Q); menu.add(actRunQuery); menu.add(actCancelQuery); menuBar.add(menu); menu = new JMenu("Explore"); menu.setMnemonic(KeyEvent.VK_X); menu.add(actPreviousMajorInstance); menu.add(actNextMajorInstance); menu.addSeparator(); menu.add(actPreviousMinorInstance); menu.add(actNextMinorInstance); menuBar.add(menu); }
From source file:org.apache.cayenne.modeler.CayenneModelerFrame.java
protected void initMenus() { getContentPane().setLayout(new BorderLayout()); JMenu fileMenu = new JMenu("File"); JMenu editMenu = new JMenu("Edit"); JMenu projectMenu = new JMenu("Project"); JMenu toolMenu = new JMenu("Tools"); JMenu helpMenu = new JMenu("Help"); fileMenu.setMnemonic(KeyEvent.VK_F); editMenu.setMnemonic(KeyEvent.VK_E); projectMenu.setMnemonic(KeyEvent.VK_P); toolMenu.setMnemonic(KeyEvent.VK_T); helpMenu.setMnemonic(KeyEvent.VK_H); fileMenu.add(getAction(NewProjectAction.class).buildMenu()); fileMenu.add(getAction(OpenProjectAction.class).buildMenu()); fileMenu.add(getAction(ProjectAction.class).buildMenu()); fileMenu.add(getAction(ImportDataMapAction.class).buildMenu()); fileMenu.addSeparator(); fileMenu.add(getAction(SaveAction.class).buildMenu()); fileMenu.add(getAction(SaveAsAction.class).buildMenu()); fileMenu.add(getAction(RevertAction.class).buildMenu()); fileMenu.addSeparator();// w w w. jav a2s . c o m editMenu.add(getAction(UndoAction.class).buildMenu()); editMenu.add(getAction(RedoAction.class).buildMenu()); editMenu.add(getAction(CutAction.class).buildMenu()); editMenu.add(getAction(CopyAction.class).buildMenu()); editMenu.add(getAction(PasteAction.class).buildMenu()); recentFileMenu = new RecentFileMenu("Recent Projects"); addRecentFileListListener(recentFileMenu); fileMenu.add(recentFileMenu); fileMenu.addSeparator(); fileMenu.add(getAction(ExitAction.class).buildMenu()); projectMenu.add(getAction(ValidateAction.class).buildMenu()); projectMenu.addSeparator(); projectMenu.add(getAction(CreateNodeAction.class).buildMenu()); projectMenu.add(getAction(CreateDataMapAction.class).buildMenu()); projectMenu.add(getAction(CreateObjEntityAction.class).buildMenu()); projectMenu.add(getAction(CreateEmbeddableAction.class).buildMenu()); projectMenu.add(getAction(CreateDbEntityAction.class).buildMenu()); projectMenu.add(getAction(CreateProcedureAction.class).buildMenu()); projectMenu.add(getAction(CreateQueryAction.class).buildMenu()); projectMenu.addSeparator(); projectMenu.add(getAction(ObjEntitySyncAction.class).buildMenu()); projectMenu.addSeparator(); projectMenu.add(getAction(RemoveAction.class).buildMenu()); toolMenu.add(getAction(ReverseEngineeringAction.class).buildMenu()); toolMenu.add(getAction(InferRelationshipsAction.class).buildMenu()); toolMenu.add(getAction(ImportEOModelAction.class).buildMenu()); toolMenu.addSeparator(); toolMenu.add(getAction(GenerateCodeAction.class).buildMenu()); toolMenu.add(getAction(GenerateDBAction.class).buildMenu()); toolMenu.add(getAction(MigrateAction.class).buildMenu()); /** * Menu for opening Log console */ toolMenu.addSeparator(); logMenu = getAction(ShowLogConsoleAction.class).buildCheckBoxMenu(); if (!LogConsole.getInstance().getConsoleProperty(LogConsole.DOCKED_PROPERTY) && LogConsole.getInstance().getConsoleProperty(LogConsole.SHOW_CONSOLE_PROPERTY)) { LogConsole.getInstance().setConsoleProperty(LogConsole.SHOW_CONSOLE_PROPERTY, false); } updateLogConsoleMenu(); toolMenu.add(logMenu); toolMenu.addSeparator(); toolMenu.add(getAction(ConfigurePreferencesAction.class).buildMenu()); helpMenu.add(getAction(AboutAction.class).buildMenu()); helpMenu.add(getAction(DocumentationAction.class).buildMenu()); JMenuBar menuBar = new JMenuBar(); menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(projectMenu); menuBar.add(toolMenu); menuBar.add(helpMenu); setJMenuBar(menuBar); }
From source file:org.apache.pdfbox.debugger.PDFDebugger.java
private JMenu createFileMenu() { JMenuItem openMenuItem = new JMenuItem("Open..."); openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, SHORCUT_KEY_MASK)); openMenuItem.addActionListener(new ActionListener() { @Override/*from w w w . j av a2s . co m*/ public void actionPerformed(ActionEvent evt) { openMenuItemActionPerformed(evt); } }); JMenu fileMenu = new JMenu("File"); fileMenu.add(openMenuItem); fileMenu.setMnemonic('F'); JMenuItem openUrlMenuItem = new JMenuItem("Open URL..."); openUrlMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, SHORCUT_KEY_MASK)); openUrlMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { String urlString = JOptionPane.showInputDialog("Enter an URL"); if (urlString == null || urlString.isEmpty()) { return; } try { readPDFurl(urlString, ""); } catch (IOException e) { throw new RuntimeException(e); } } }); fileMenu.add(openUrlMenuItem); reopenMenuItem = new JMenuItem("Reopen"); reopenMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, SHORCUT_KEY_MASK)); reopenMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { try { if (currentFilePath.startsWith("http")) { readPDFurl(currentFilePath, ""); } else { readPDFFile(currentFilePath, ""); } } catch (IOException e) { new ErrorDialog(e).setVisible(true); } } }); reopenMenuItem.setEnabled(false); fileMenu.add(reopenMenuItem); try { recentFiles = new RecentFiles(this.getClass(), 5); } catch (Exception e) { throw new RuntimeException(e); } recentFilesMenu = new JMenu("Open Recent"); recentFilesMenu.setEnabled(false); addRecentFileItems(); fileMenu.add(recentFilesMenu); printMenuItem = new JMenuItem("Print"); printMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, SHORCUT_KEY_MASK)); printMenuItem.setEnabled(false); printMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { printMenuItemActionPerformed(evt); } }); if (!IS_MAC_OS) { fileMenu.addSeparator(); fileMenu.add(printMenuItem); } JMenuItem exitMenuItem = new JMenuItem("Exit"); exitMenuItem.setAccelerator(KeyStroke.getKeyStroke("alt F4")); exitMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); if (!IS_MAC_OS) { fileMenu.addSeparator(); fileMenu.add(exitMenuItem); } return fileMenu; }
From source file:org.apache.pdfbox.debugger.PDFDebugger.java
private JMenu createEditMenu() { JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('E'); JMenuItem cutMenuItem = new JMenuItem("Cut"); cutMenuItem.setEnabled(false);/* ww w.j a v a 2 s . c o m*/ editMenu.add(cutMenuItem); JMenuItem copyMenuItem = new JMenuItem("Copy"); copyMenuItem.setEnabled(false); editMenu.add(copyMenuItem); JMenuItem pasteMenuItem = new JMenuItem("Paste"); pasteMenuItem.setEnabled(false); editMenu.add(pasteMenuItem); JMenuItem deleteMenuItem = new JMenuItem("Delete"); deleteMenuItem.setEnabled(false); editMenu.add(deleteMenuItem); editMenu.addSeparator(); editMenu.add(createFindMenu()); return editMenu; }
From source file:org.apache.pdfbox.debugger.PDFDebugger.java
private JMenu createViewMenu() { JMenu viewMenu = new JMenu("View"); viewMenu.setMnemonic('V'); if (isPageMode) { viewModeItem = new JMenuItem("Show Internal Structure"); } else {/*from www . j ava 2 s. c om*/ viewModeItem = new JMenuItem("Show Pages"); } viewModeItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (isPageMode) { viewModeItem.setText("Show Pages"); isPageMode = false; } else { viewModeItem.setText("Show Internal Structure"); isPageMode = true; } if (document != null) { initTree(); } } }); viewMenu.add(viewModeItem); ZoomMenu zoomMenu = ZoomMenu.getInstance(); zoomMenu.setEnableMenu(false); viewMenu.add(zoomMenu.getMenu()); RotationMenu rotationMenu = RotationMenu.getInstance(); rotationMenu.setEnableMenu(false); viewMenu.add(rotationMenu.getMenu()); viewMenu.addSeparator(); showTextStripper = new JCheckBoxMenuItem("Show TextStripper TextPositions"); showTextStripper.setEnabled(false); viewMenu.add(showTextStripper); showTextStripperBeads = new JCheckBoxMenuItem("Show TextStripper Beads"); showTextStripperBeads.setEnabled(false); viewMenu.add(showTextStripperBeads); showFontBBox = new JCheckBoxMenuItem("Show Approximate Text Bounds"); showFontBBox.setEnabled(false); viewMenu.add(showFontBBox); showGlyphBounds = new JCheckBoxMenuItem("Show Glyph Bounds"); showGlyphBounds.setEnabled(false); viewMenu.add(showGlyphBounds); return viewMenu; }
From source file:org.apache.tika.gui.TikaGUI.java
private void addMenuBar() { JMenuBar bar = new JMenuBar(); JMenu file = new JMenu("File"); file.setMnemonic(KeyEvent.VK_F); addMenuItem(file, "Open...", "openfile", KeyEvent.VK_O); addMenuItem(file, "Open URL...", "openurl", KeyEvent.VK_U); file.addSeparator(); addMenuItem(file, "Exit", "exit", KeyEvent.VK_X); bar.add(file);//from w ww .ja v a2 s .c o m JMenu view = new JMenu("View"); view.setMnemonic(KeyEvent.VK_V); addMenuItem(view, "Metadata", "metadata", KeyEvent.VK_M); addMenuItem(view, "Formatted text", "html", KeyEvent.VK_F); addMenuItem(view, "Plain text", "text", KeyEvent.VK_P); addMenuItem(view, "Main content", "main", KeyEvent.VK_C); addMenuItem(view, "Structured text", "xhtml", KeyEvent.VK_S); addMenuItem(view, "Recursive JSON", "json", KeyEvent.VK_J); bar.add(view); bar.add(Box.createHorizontalGlue()); JMenu help = new JMenu("Help"); help.setMnemonic(KeyEvent.VK_H); addMenuItem(help, "About Tika", "about", KeyEvent.VK_A); bar.add(help); setJMenuBar(bar); }
From source file:org.ayound.js.debug.ui.DebugMainFrame.java
protected JMenuBar createMenuBar() { final JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu(Messages.getString("DebugMainFrame.File")); //$NON-NLS-1$ fileMenu.setMnemonic('f'); JMenuItem item = null;/*from w w w.ja v a2s . c o m*/ item = fileMenu.add(actionOpen); fileMenu.add(item); item = fileMenu.add(actionClose); fileMenu.add(item); fileMenu.addSeparator(); item = fileMenu.add(actionExit); item.setMnemonic('x'); menuBar.add(fileMenu); JMenu debugMenu = new JMenu(Messages.getString("DebugMainFrame.Debug")); //$NON-NLS-1$ debugMenu.setMnemonic('d'); item = debugMenu.add(actionDebugStart); debugMenu.add(item); menuBar.add(debugMenu); item = debugMenu.add(actionDebugEnd); debugMenu.add(item); JMenu helpMenu = new JMenu(Messages.getString("DebugMainFrame.Help")); //$NON-NLS-1$ helpMenu.setMnemonic('d'); item = helpMenu.add(actionHelp); helpMenu.add(item); item = helpMenu.add(actionAbout); helpMenu.add(item); JMenu languageMenu = new JMenu("lauguage"); item = languageMenu.add(actionLanguageChinese); languageMenu.add(item); item = languageMenu.add(actionLanguageEnglish); languageMenu.add(item); menuBar.add(languageMenu); menuBar.add(helpMenu); return menuBar; }
From source file:org.broad.igv.hic.MainWindow.java
private void addPredefinedLoadItems(JMenu fileMenu) { //---- loadGM ---- JMenuItem loadGM = new JMenuItem("GM cell line (human)"); loadGM.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { heatmapPanel.setObservedRange(0, 100); colorRangeSlider.setMaximum(100); colorRangeSlider.setMinimum(0); colorRangeSlider.setMajorTickSpacing(10); hic.reset();//from ww w.ja v a2 s. co m load("http://www.broadinstitute.org/igvdata/hic/hg18/GM.summary.binned.hic"); } catch (IOException e1) { JOptionPane.showMessageDialog(MainWindow.this, "Error loading data: " + e1.getMessage()); } } }); fileMenu.add(loadGM); //---- load562 ---- JMenuItem load562 = new JMenuItem("K562 cell line (human)"); load562.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { heatmapPanel.setObservedRange(0, 100); colorRangeSlider.setMaximum(100); colorRangeSlider.setMinimum(0); colorRangeSlider.setMajorTickSpacing(10); hic.reset(); load("http://www.broadinstitute.org/igvdata/hic/hg18/K562.summary.binned.hic"); } catch (IOException e1) { JOptionPane.showMessageDialog(MainWindow.this, "Error loading data: " + e1.getMessage()); } } }); fileMenu.add(load562); fileMenu.addSeparator(); //---- loadFeb ---- JMenuItem loadFeb = new JMenuItem("HiSeq Hi-C Human (02/01/2012)"); loadFeb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { heatmapPanel.setObservedRange(0, 20); colorRangeSlider.setMaximum(2000); colorRangeSlider.setMinimum(0); colorRangeSlider.setMajorTickSpacing(100); colorRangeSlider.setUpperValue(1500); hic.reset(); load("http://iwww.broadinstitute.org/igvdata/hic/HiSeq/120201.hic"); } catch (IOException e1) { JOptionPane.showMessageDialog(MainWindow.this, "Error loading data: " + e1.getMessage()); } } } ); fileMenu.add(loadFeb); //---- loadFeb ---- JMenuItem loadApr = new JMenuItem("HiSeq Hi-C Human (04/01/2012)"); loadApr.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { heatmapPanel.setObservedRange(0, 20); colorRangeSlider.setMaximum(3000); colorRangeSlider.setMinimum(0); colorRangeSlider.setMajorTickSpacing(500); colorRangeSlider.setUpperValue(2500); hic.reset(); load("http://iwww.broadinstitute.org/igvdata/hic/files/April_2012/120401.hic"); } catch (IOException e1) { JOptionPane.showMessageDialog(MainWindow.this, "Error loading data: " + e1.getMessage()); } } } ); fileMenu.add(loadApr); fileMenu.addSeparator(); //---- loadHindIII ---- JMenuItem loadHindIII = new JMenuItem("MiSeq Hi-C Human (08/01/2011)"); loadHindIII.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { heatmapPanel.setObservedRange(0, 20); colorRangeSlider.setMaximum(50); colorRangeSlider.setMajorTickSpacing(10); colorRangeSlider.setMinimum(0); colorRangeSlider.setUpperValue(20); hic.reset(); load("http://iwww.broadinstitute.org/igvdata/hic/MiSeq/Hi-C_HindIII_Human_August.hic"); } catch (IOException e1) { JOptionPane.showMessageDialog(MainWindow.this, "Error loading data: " + e1.getMessage()); } } } ); fileMenu.add(loadHindIII); //---- loadMar2 ---- JMenuItem loadMar2 = new JMenuItem("MiSeq Hi-C Human (05/18/2012)"); loadMar2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { heatmapPanel.setObservedRange(0, 1); colorRangeSlider.setMaximum(50); colorRangeSlider.setMinimum(0); colorRangeSlider.setUpperValue(20); colorRangeSlider.setMajorTickSpacing(10); hic.reset(); load("https://iwww.broadinstitute.org/igvdata/hic/MiSeq/Elena_Human_120518.hic"); } catch (IOException e1) { JOptionPane.showMessageDialog(MainWindow.this, "Error loading data: " + e1.getMessage()); } } } ); fileMenu.add(loadMar2); //---- loadCoolAid ---- JMenuItem loadCoolAid = new JMenuItem("MiSeq COOL-AID Mouse (12/11/2011)"); loadCoolAid.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { heatmapPanel.setObservedRange(0, 1); colorRangeSlider.setMaximum(5); colorRangeSlider.setMinimum(0); colorRangeSlider.setUpperValue(1); colorRangeSlider.setMajorTickSpacing(1); hic.reset(); load("https://iwww.broadinstitute.org/igvdata/hic/MiSeq/COOL-AID_Elena_Mouse_December11.hic"); } catch (IOException e1) { JOptionPane.showMessageDialog(MainWindow.this, "Error loading data: " + e1.getMessage()); } } } ); fileMenu.add(loadCoolAid); fileMenu.addSeparator(); //---- loadDmelDataset ---- JMenuItem loadDmelDataset = new JMenuItem("Fly"); loadDmelDataset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { heatmapPanel.setObservedRange(0, 20000); colorRangeSlider.setMaximum(20000); colorRangeSlider.setMinimum(0); hic.reset(); load("http://iwww.broadinstitute.org/igvdata/hic/dmel/selected_formatted.hic"); } catch (IOException e1) { JOptionPane.showMessageDialog(MainWindow.this, "Error loading data: " + e1.getMessage()); } } } ); fileMenu.add(loadDmelDataset); fileMenu.addSeparator(); }
From source file:org.broad.igv.hic.MainWindow.java
private JMenuBar createMenuBar(final JPanel hiCPanel) { JMenuBar menuBar = new JMenuBar(); //======== fileMenu ======== JMenu fileMenu = new JMenu("File"); //---- loadMenuItem ---- JMenuItem loadMenuItem = new JMenuItem(); loadMenuItem.setText("Load..."); loadMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { loadMenuItemActionPerformed(e); }//from w w w . j a v a 2s .com }); fileMenu.add(loadMenuItem); //---- loadFromURL ---- JMenuItem loadFromURL = new JMenuItem(); JMenuItem getEigenvector = new JMenuItem(); final JCheckBoxMenuItem viewDNAseI; loadFromURL.setText("Load from URL ..."); loadFromURL.setName("loadFromURL"); loadFromURL.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { loadFromURLActionPerformed(e); } }); fileMenu.add(loadFromURL); fileMenu.addSeparator(); // Pre-defined datasets. TODO -- generate from a file addPredefinedLoadItems(fileMenu); JMenuItem saveToImage = new JMenuItem(); saveToImage.setText("Save to image"); saveToImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { BufferedImage image = (BufferedImage) createImage(1000, 1000); Graphics g = image.createGraphics(); hiCPanel.paint(g); JFileChooser fc = new JFileChooser(); fc.setSelectedFile(new File("image.png")); int actionDialog = fc.showSaveDialog(null); if (actionDialog == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); if (file.exists()) { actionDialog = JOptionPane.showConfirmDialog(null, "Replace existing file?"); if (actionDialog == JOptionPane.NO_OPTION || actionDialog == JOptionPane.CANCEL_OPTION) return; } try { // default if they give no format or invalid format String fmt = "jpg"; int ind = file.getName().indexOf("."); if (ind != -1) { String ext = file.getName().substring(ind + 1); String[] strs = ImageIO.getWriterFormatNames(); for (String aStr : strs) if (ext.equals(aStr)) fmt = ext; } ImageIO.write(image.getSubimage(0, 0, 600, 600), fmt, file); } catch (IOException ie) { System.err.println("Unable to write " + file + ": " + ie); } } } }); fileMenu.add(saveToImage); getEigenvector = new JMenuItem("Get principal eigenvector"); getEigenvector.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getEigenvectorActionPerformed(e); } }); fileMenu.add(getEigenvector); //---- exit ---- JMenuItem exit = new JMenuItem(); exit.setText("Exit"); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { exitActionPerformed(e); } }); fileMenu.add(exit); menuBar.add(fileMenu); //======== Tracks menu ======== JMenu tracksMenu = new JMenu("Tracks"); viewEigenvector = new JCheckBoxMenuItem("View Eigenvector..."); viewEigenvector.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (viewEigenvector.isSelected()) { if (eigenvectorTrack == null) { eigenvectorTrack = new EigenvectorTrack("eigen", "Eigenvectors"); } updateEigenvectorTrack(); } else { trackPanel.setEigenvectorTrack(null); if (HiCTrackManager.getLoadedTracks().isEmpty()) { trackPanel.setVisible(false); } } } }); viewEigenvector.setEnabled(false); tracksMenu.add(viewEigenvector); JMenuItem loadItem = new JMenuItem("Load..."); loadItem.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { HiCTrackManager.loadHostedTrack(MainWindow.this); } }); tracksMenu.add(loadItem); JMenuItem loadFromFileItem = new JMenuItem("Load from file..."); loadFromFileItem.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { HiCTrackManager.loadTrackFromFile(MainWindow.this); } }); tracksMenu.add(loadFromFileItem); menuBar.add(tracksMenu); //======== Extras menu ======== JMenu extrasMenu = new JMenu("Extras"); JMenuItem dumpPearsons = new JMenuItem("Dump pearsons matrix ..."); dumpPearsons.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { BasicMatrix pearsons = hic.zd.getPearsons(); try { String chr1 = hic.getChromosomes()[hic.zd.getChr1()].getName(); String chr2 = hic.getChromosomes()[hic.zd.getChr2()].getName(); int binSize = hic.zd.getBinSize(); File initFile = new File("pearsons_" + chr1 + "_" + "_" + chr2 + "_" + binSize + ".bin"); File f = FileDialogUtils.chooseFile("Save pearsons", null, initFile, FileDialogUtils.SAVE); if (f != null) { ScratchPad.dumpPearsonsBinary(pearsons, chr1, chr2, hic.zd.getBinSize(), f); } } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } }); JMenuItem dumpEigenvector = new JMenuItem("Dump eigenvector ..."); dumpEigenvector.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { try { ScratchPad.dumpEigenvector(hic); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } }); extrasMenu.add(dumpEigenvector); JMenuItem readPearsons = new JMenuItem("Read pearsons..."); readPearsons.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { try { File f = FileDialogUtils.chooseFile("Pearsons file (Yunfan format)"); if (f != null) { BasicMatrix bm = ScratchPad.readPearsons(f.getAbsolutePath()); hic.zd.setPearsons(bm); } } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } }); extrasMenu.add(readPearsons); extrasMenu.add(dumpPearsons); menuBar.add(extrasMenu); return menuBar; }