Search in sources :

Example 26 with JPopupMenu

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

the class ErrorTreeCellRenderer method getNewNodePopupMenu.

/**
	 * This method initializes jPopupMenu	
	 * 	
	 * @return javax.swing.JPopupMenu	
	 */
private JPopupMenu getNewNodePopupMenu() {
    if (newNodePopupMenu == null) {
        newNodePopupMenu = new JPopupMenu();
        newNodePopupMenu.add(getNewErrorMenuItem());
        newNodePopupMenu.add(getNewCompletionMenuItem());
    }
    return newNodePopupMenu;
}
Also used : JPopupMenu(javax.swing.JPopupMenu)

Example 27 with JPopupMenu

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

the class ErrorTreeCellRenderer method getAddPopupMenu.

/**
	 * This method initializes jPopupMenu	
	 * 	
	 * @return javax.swing.JPopupMenu	
	 */
private JPopupMenu getAddPopupMenu() {
    if (addPopupMenu == null) {
        addPopupMenu = new JPopupMenu();
        addPopupMenu.add(getAddFileItem());
        addPopupMenu.add(getAddDirectoryItem());
        addPopupMenu.add(getAddDefaultsItem());
    }
    return addPopupMenu;
}
Also used : JPopupMenu(javax.swing.JPopupMenu)

Example 28 with JPopupMenu

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

the class HeatMapMainPanel method showExportMenu.

private void showExportMenu(ActionEvent event) {
    JPopupMenu menu = new JPopupMenu();
    menu.add(txtActionFactory.create(table));
    menu.add(pdfActionFactory.create(table));
    Component c = (Component) event.getSource();
    menu.show(c, 0, c.getHeight());
}
Also used : Component(java.awt.Component) JPopupMenu(javax.swing.JPopupMenu)

Example 29 with JPopupMenu

use of javax.swing.JPopupMenu 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 30 with JPopupMenu

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

the class SettingsPopupPanel method popup.

public void popup(Component parent) {
    JPopupMenu menu = new JPopupMenu();
    menu.add(this);
    menu.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                menu.setVisible(false);
            }
        }
    });
    menu.show(parent, 0, parent.getHeight());
}
Also used : MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) JPopupMenu(javax.swing.JPopupMenu)

Aggregations

JPopupMenu (javax.swing.JPopupMenu)128 JMenuItem (javax.swing.JMenuItem)56 ActionEvent (java.awt.event.ActionEvent)34 ActionListener (java.awt.event.ActionListener)20 JMenu (javax.swing.JMenu)19 Component (java.awt.Component)17 JButton (javax.swing.JButton)16 JScrollPane (javax.swing.JScrollPane)15 AbstractAction (javax.swing.AbstractAction)14 JLabel (javax.swing.JLabel)14 MouseEvent (java.awt.event.MouseEvent)13 Point (java.awt.Point)11 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)11 JSeparator (javax.swing.JSeparator)11 JPanel (javax.swing.JPanel)10 JTable (javax.swing.JTable)10 Dimension (java.awt.Dimension)7 ArrayList (java.util.ArrayList)7 JTextArea (javax.swing.JTextArea)7 JCheckBox (javax.swing.JCheckBox)6