Example usage for javax.swing JPopupMenu.Separator JPopupMenu.Separator

List of usage examples for javax.swing JPopupMenu.Separator JPopupMenu.Separator

Introduction

In this page you can find the example usage for javax.swing JPopupMenu.Separator JPopupMenu.Separator.

Prototype

JPopupMenu.Separator

Source Link

Usage

From source file:slash.navigation.converter.gui.profileview.LazyToolTipChartPanel.java

protected JPopupMenu createPopupMenu(boolean properties, boolean copy, boolean save, boolean print,
        boolean zoom) {
    JPopupMenu popupMenu = super.createPopupMenu(properties, copy, save, print, zoom);
    // remove Zoom in/out plus separator from default menu
    popupMenu.remove(6);//  w  ww.  j av a 2s  .c  o m
    popupMenu.remove(5);
    popupMenu.remove(4);
    JMenu menu = createMenu("show-profile");
    new ProfileModeMenu(menu, profileModeModel);
    popupMenu.add(menu, 0);
    popupMenu.add(new JPopupMenu.Separator(), 1);
    return popupMenu;
}

From source file:gui.DownloadPanel.java

private JPopupMenu initPopupMenu() {
    JPopupMenu popupMenu = new JPopupMenu();

    openItem = new JMenuItem(bundle.getString("downloadPanel.openItem.name"));
    openItem.addActionListener(this);
    openFolderItem = new JMenuItem(bundle.getString("downloadPanel.openFolderItem.name"));
    openFolderItem.addActionListener(this);

    resumeItem = new JMenuItem(bundle.getString("downloadPanel.resumeItem.name"));
    resumeItem.addActionListener(this);
    pauseItem = new JMenuItem(bundle.getString("downloadPanel.pauseItem.name"));
    pauseItem.addActionListener(this);
    clearItem = new JMenuItem(bundle.getString("downloadPanel.clearItem.name"));
    clearItem.addActionListener(this);

    reJoinItem = new JMenuItem(bundle.getString("downloadPanel.reJoinItem.name"));
    reJoinItem.addActionListener(this);
    reDownloadItem = new JMenuItem(bundle.getString("downloadPanel.reDownloadItem.name"));
    reDownloadItem.addActionListener(this);

    moveToQueueItem = new JMenuItem(bundle.getString("downloadPanel.moveToQueueItem.name"));
    moveToQueueItem.addActionListener(this);
    removeFromQueueItem = new JMenuItem(bundle.getString("downloadPanel.removeFromQueueItem.name"));
    removeFromQueueItem.addActionListener(this);

    propertiesItem = new JMenuItem(bundle.getString("downloadPanel.propertiesItem.name"));
    propertiesItem.addActionListener(this);

    popupMenu.add(openItem);//from  w ww  . j a v a2s .c  om
    popupMenu.add(openFolderItem);
    popupMenu.add(new JPopupMenu.Separator());
    popupMenu.add(resumeItem);
    popupMenu.add(pauseItem);
    popupMenu.add(clearItem);
    popupMenu.add(new JPopupMenu.Separator());
    popupMenu.add(reJoinItem);
    popupMenu.add(reDownloadItem);
    popupMenu.add(new JPopupMenu.Separator());
    popupMenu.add(moveToQueueItem);
    popupMenu.add(removeFromQueueItem);
    popupMenu.add(new JPopupMenu.Separator());
    popupMenu.add(propertiesItem);

    setStateOfMenuItems();

    return popupMenu;
}

From source file:unikn.dbis.univis.navigation.tree.VTree.java

/**
 * TODO: document me!!!/*  ww  w  . jav  a  2 s . c o  m*/
 *
 * @param p
 */
public void showPopupMenu(Point p) {

    // Remove all items from popup menu.
    popupMenu.removeAll();

    Object o = getLastSelectedPathComponent();

    if (o instanceof DefaultMutableTreeNode) {

        DefaultMutableTreeNode node = (DefaultMutableTreeNode) o;

        Object userObject = node.getUserObject();

        if (userObject instanceof VDimension) {

            VDimension dimension = (VDimension) userObject;

            try {
                Point p2 = new Point(p);
                SwingUtilities.convertPointToScreen(p2, this);

                final FilterItemContainer container = createFilterContainer(dimension, p2);

                if (!container.isEmpty()) {
                    /*
                    JLabel header = new JLabel(MessageResolver.getMessage("data_reference." + dimension.getI18nKey()));
                    Font font = header.getFont();
                    header.setFont(new Font(font.getFontName(), Font.BOLD, font.getSize() + 2));
                    popupMenu.add(header);
                    popupMenu.add(new JPopupMenu.Separator());
                    */

                    popupMenu = new FilterPopupMenu(
                            MessageResolver.getMessage("data_reference." + dimension.getI18nKey()));

                    final JCheckBox button = new JCheckBox("Check/Uncheck all");

                    button.setSelected(container.isAllChecked());

                    button.addActionListener(new ActionListener() {
                        /**
                         * Invoked when an action occurs.
                         */
                        public void actionPerformed(ActionEvent e) {

                            for (Component c : container.getComponents()) {
                                if (c instanceof VBidirectionalBrowsingItem) {
                                    ((VBidirectionalBrowsingItem) c).getCheckBox()
                                            .setChecked(button.isSelected());
                                }
                            }
                        }
                    });

                    popupMenu.add(button);

                    popupMenu.add(new JPopupMenu.Separator());

                    popupMenu.add(container);

                    JButton view = new JButton(MessageResolver.getMessage("filtering"), VIcons.FILTER);
                    view.addActionListener(new ActionListener() {

                        /**
                         * Invoked when an action occurs.
                         */
                        public void actionPerformed(ActionEvent e) {
                            popupMenu.setVisible(false);
                        }
                    });

                    popupMenu.add(new JPopupMenu.Separator());

                    popupMenu.add(view);

                    popupMenu.show(VTree.this, (int) p.getX(), (int) p.getY());
                } else {
                    JOptionPane.showMessageDialog(VTree.this.getParent().getParent().getParent(),
                            MessageResolver.getMessage("no_items_found"),
                            MessageResolver.getMessage("error_message"), JOptionPane.ERROR_MESSAGE);
                }
            } catch (SQLException sqle) {
                VExplorer.publishException(sqle);

                if (LOG.isErrorEnabled()) {
                    LOG.error(sqle.getMessage(), sqle);
                }
            }
        }
    }
}