Search in sources :

Example 11 with JMenuItem

use of javax.swing.JMenuItem in project EnrichmentMapApp by BaderLab.

the class ColumnHeaderRankOptionRenderer method menuButtonClicked.

private void menuButtonClicked(JTable table, JButton button) {
    JTableHeader header = table.getTableHeader();
    List<RankingOption> rankOptions = mainPanel.getAllRankingOptions();
    JPopupMenu menu = new JPopupMenu();
    for (RankingOption rankOption : rankOptions) {
        JMenuItem item = new JCheckBoxMenuItem(rankOption.getName());
        item.setSelected(rankOption == mainPanel.getSelectedRankOption());
        SwingUtil.makeSmall(item);
        menu.add(item);
        item.addActionListener(e -> mainPanel.updateSetting_RankOption(rankOption));
    }
    int y = button.getHeight();
    int x = 0;
    for (int i = 0; i < colIndex; i++) {
        TableColumn tableColumn = table.getColumnModel().getColumn(i);
        x += tableColumn.getWidth();
    }
    menu.show(header, x, y);
}
Also used : JTableHeader(javax.swing.table.JTableHeader) RankingOption(org.baderlab.csplugins.enrichmentmap.view.heatmap.RankingOption) JMenuItem(javax.swing.JMenuItem) TableColumn(javax.swing.table.TableColumn) JPopupMenu(javax.swing.JPopupMenu) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem)

Example 12 with JMenuItem

use of javax.swing.JMenuItem in project ACS by ACS-Community.

the class ScriptFilter method getFileMenuSaveStatusButton.

/**
	 * This method initializes FileMenuSaveStatusButton
	 * @return javax.swing.JMenuItem
	 */
private JMenuItem getFileMenuSaveStatusButton() {
    if (FileMenuSaveStatusButton == null) {
        FileMenuSaveStatusButton = new JMenuItem();
        FileMenuSaveStatusButton.setText("Save GUI status");
        FileMenuSaveStatusButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent e) {
                JFileChooser chooser = new JFileChooser();
                int returnVal = chooser.showSaveDialog(cl.utfsm.samplingSystemUI.SamplingSystemGUI.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    try {
                        String file = chooser.getSelectedFile().getAbsolutePath();
                        if (file.endsWith(".ssgst")) {
                            writeStatusFile(file);
                        } else {
                            writeStatusFile(file + ".ssgst");
                        }
                    } catch (ParserConfigurationException e1) {
                        e1.printStackTrace();
                    } catch (TransformerException e1) {
                        e1.printStackTrace();
                    } catch (FileNotFoundException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        });
    }
    return FileMenuSaveStatusButton;
}
Also used : JFileChooser(javax.swing.JFileChooser) FileNotFoundException(java.io.FileNotFoundException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) JMenuItem(javax.swing.JMenuItem) ActionEvent(java.awt.event.ActionEvent) TransformerException(javax.xml.transform.TransformerException)

Example 13 with JMenuItem

use of javax.swing.JMenuItem in project ACS by ACS-Community.

the class LogMenuBar method getSaveFileMenuItem.

/**
	 * Returns the SaveFileMenuItem property value.
	 * @return javax.swing.JMenuItem
	 */
public JMenuItem getSaveFileMenuItem() {
    if (saveFileMenuItem == null) {
        ImageIcon icon = new ImageIcon(LogTypeHelper.class.getResource("/disk.png"));
        saveFileMenuItem = new JMenuItem("Save File As", icon);
        saveFileMenuItem.setName("SaveFileMenuItem");
    }
    return saveFileMenuItem;
}
Also used : ImageIcon(javax.swing.ImageIcon) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper) JMenuItem(javax.swing.JMenuItem)

Example 14 with JMenuItem

use of javax.swing.JMenuItem in project ACS by ACS-Community.

the class LogMenuBar method getLoadDBMenuItem.

/**
	 * Returns the LoadDB menu item
	 * 
	 * @return The LoadDB menu item
	 */
public JMenuItem getLoadDBMenuItem() {
    if (loadDBMenuItem == null) {
        ImageIcon icon = new ImageIcon(LogTypeHelper.class.getResource("/database.png"));
        loadDBMenuItem = new JMenuItem("Load from database", icon);
        loadDBMenuItem.setName("LoadDBMenuItem");
    }
    return loadDBMenuItem;
}
Also used : ImageIcon(javax.swing.ImageIcon) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper) JMenuItem(javax.swing.JMenuItem)

Example 15 with JMenuItem

use of javax.swing.JMenuItem in project ACS by ACS-Community.

the class LogMenuBar method getFiltersMenuItem.

/**
	 * Return the editFiltersMenuItem
	 * @return
	 */
public JMenuItem getFiltersMenuItem() {
    if (filtersMenuItem == null) {
        ImageIcon filterIcon = new ImageIcon(LogTypeHelper.class.getResource("/filters.png"));
        filtersMenuItem = new JMenuItem("Filters...", filterIcon);
        filtersMenuItem.setName("EditFiltersMenuItem");
    }
    return filtersMenuItem;
}
Also used : ImageIcon(javax.swing.ImageIcon) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper) JMenuItem(javax.swing.JMenuItem)

Aggregations

JMenuItem (javax.swing.JMenuItem)1138 ActionEvent (java.awt.event.ActionEvent)559 ActionListener (java.awt.event.ActionListener)463 JMenu (javax.swing.JMenu)373 JPopupMenu (javax.swing.JPopupMenu)229 JMenuBar (javax.swing.JMenuBar)104 AbstractAction (javax.swing.AbstractAction)90 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)76 ArrayList (java.util.ArrayList)72 JPanel (javax.swing.JPanel)70 Point (java.awt.Point)65 JSeparator (javax.swing.JSeparator)63 File (java.io.File)61 JLabel (javax.swing.JLabel)61 BorderLayout (java.awt.BorderLayout)57 JButton (javax.swing.JButton)54 Component (java.awt.Component)53 ButtonGroup (javax.swing.ButtonGroup)50 Dimension (java.awt.Dimension)46 MouseEvent (java.awt.event.MouseEvent)45