Example usage for javax.swing JMenuItem addActionListener

List of usage examples for javax.swing JMenuItem addActionListener

Introduction

In this page you can find the example usage for javax.swing JMenuItem addActionListener.

Prototype

public void addActionListener(ActionListener l) 

Source Link

Document

Adds an ActionListener to the button.

Usage

From source file:MenuSelectionManagerDemo.java

public JMenuBar createMenuBar() {
    JMenuBar menuBar;/* w  w w.  ja  va  2  s  .  c  o  m*/
    JMenu menu, submenu;
    JMenuItem menuItem;
    JRadioButtonMenuItem rbMenuItem;
    JCheckBoxMenuItem cbMenuItem;

    //Create the menu bar.
    menuBar = new JMenuBar();

    //Build the first menu.
    menu = new JMenu("A Menu");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
    menuBar.add(menu);

    //a group of JMenuItems
    menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
    //menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
    menuItem.addActionListener(this);
    menu.add(menuItem);

    ImageIcon icon = createImageIcon("1.gif");
    menuItem = new JMenuItem("Both text and icon", icon);
    menuItem.setMnemonic(KeyEvent.VK_B);
    menuItem.addActionListener(this);
    menu.add(menuItem);

    menuItem = new JMenuItem(icon);
    menuItem.setMnemonic(KeyEvent.VK_D);
    menuItem.addActionListener(this);
    menu.add(menuItem);

    //a group of radio button menu items
    menu.addSeparator();
    ButtonGroup group = new ButtonGroup();

    rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
    rbMenuItem.setSelected(true);
    rbMenuItem.setMnemonic(KeyEvent.VK_R);
    group.add(rbMenuItem);
    rbMenuItem.addActionListener(this);
    menu.add(rbMenuItem);

    rbMenuItem = new JRadioButtonMenuItem("Another one");
    rbMenuItem.setMnemonic(KeyEvent.VK_O);
    group.add(rbMenuItem);
    rbMenuItem.addActionListener(this);
    menu.add(rbMenuItem);

    //a group of check box menu items
    menu.addSeparator();
    cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
    cbMenuItem.setMnemonic(KeyEvent.VK_C);
    cbMenuItem.addItemListener(this);
    menu.add(cbMenuItem);

    cbMenuItem = new JCheckBoxMenuItem("Another one");
    cbMenuItem.setMnemonic(KeyEvent.VK_H);
    cbMenuItem.addItemListener(this);
    menu.add(cbMenuItem);

    //a submenu
    menu.addSeparator();
    submenu = new JMenu("A submenu");
    submenu.setMnemonic(KeyEvent.VK_S);

    menuItem = new JMenuItem("An item in the submenu");
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
    menuItem.addActionListener(this);
    submenu.add(menuItem);

    menuItem = new JMenuItem("Another item");
    menuItem.addActionListener(this);
    submenu.add(menuItem);
    menu.add(submenu);

    //Build second menu in the menu bar.
    menu = new JMenu("Another Menu");
    menu.setMnemonic(KeyEvent.VK_N);
    menu.getAccessibleContext().setAccessibleDescription("This menu does nothing");
    menuBar.add(menu);

    Timer timer = new Timer(ONE_SECOND, new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            MenuElement[] path = MenuSelectionManager.defaultManager().getSelectedPath();
            for (int i = 0; i < path.length; i++) {
                if (path[i].getComponent() instanceof javax.swing.JMenuItem) {
                    JMenuItem mi = (JMenuItem) path[i].getComponent();
                    if ("".equals(mi.getText())) {
                        output.append("ICON-ONLY MENU ITEM > ");
                    } else {
                        output.append(mi.getText() + " > ");
                    }
                }
            }
            if (path.length > 0)
                output.append(newline);
        }
    });
    timer.start();
    return menuBar;
}

From source file:gdt.jgui.entity.fields.JFieldsEditor.java

/**
 * Get the context menu./*  ww w .j  ava  2  s.  co m*/
 * @return the context menu.
 */
@Override
public JMenu getContextMenu() {
    menu = new JMenu("Context");
    menu.addMenuListener(new MenuListener() {
        @Override
        public void menuSelected(MenuEvent e) {
            //         System.out.println("FieldsEditor:getConextMenu:menu selected");

            if (editCellItem != null)
                menu.remove(editCellItem);
            if (deleteItemsItem != null)
                menu.remove(deleteItemsItem);
            if (copyItem != null)
                menu.remove(copyItem);
            if (pasteItem != null)
                menu.remove(pasteItem);
            if (cutItem != null)
                menu.remove(cutItem);

            if (hasEditingCell()) {
                editCellItem = new JMenuItem("Edit item");
                editCellItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            JTextEditor textEditor = new JTextEditor();
                            String locator$ = textEditor.getLocator();
                            locator$ = Locator.append(locator$, Entigrator.ENTIHOME, entihome$);
                            locator$ = Locator.append(locator$, EntityHandler.ENTITY_KEY, entityKey$);
                            String responseLocator$ = getEditCellLocator();
                            text$ = Locator.getProperty(responseLocator$, JTextEditor.TEXT);
                            locator$ = Locator.append(locator$, JTextEditor.TEXT, text$);
                            //                  System.out.println("FieldsEditor:edit cell:text="+text$);
                            locator$ = Locator.append(locator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                    Locator.compressText(responseLocator$));
                            JConsoleHandler.execute(console, locator$);
                        } catch (Exception ee) {
                            LOGGER.severe(ee.toString());
                        }
                    }
                });
                menu.add(editCellItem);
            }
            if (hasSelectedRows()) {
                deleteItemsItem = new JMenuItem("Delete items");
                deleteItemsItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        int response = JOptionPane.showConfirmDialog(JFieldsEditor.this,
                                "Delete selected fields ?", "Confirm", JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE);
                        if (response == JOptionPane.YES_OPTION) {
                            deleteRows();
                        }
                    }
                });
                menu.add(deleteItemsItem);
                copyItem = new JMenuItem("Copy");
                copyItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        copy(false);
                    }
                });
                menu.add(copyItem);
                cutItem = new JMenuItem("Cut");
                cutItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        copy(true);
                    }
                });
                menu.add(cutItem);
            }
            if (hasFieldsToPaste()) {
                pasteItem = new JMenuItem("Paste");
                pasteItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            String[] sa = console.clipboard.getContent();
                            Properties locator;
                            String type$;
                            String sourceEntityKey$;
                            Sack sourceEntity;
                            String sourceEntihome$;
                            Entigrator sourceEntigrator;
                            for (String aSa : sa) {
                                //System.out.println("FieldsEditor:paste:"+aSa);
                                locator = Locator.toProperties(aSa);
                                type$ = locator.getProperty(Locator.LOCATOR_TYPE);
                                if (LOCATOR_TYPE_FIELD.equals(type$)) {
                                    String action$ = locator.getProperty(JRequester.REQUESTER_ACTION);
                                    String name$ = locator.getProperty(CELL_FIELD_NAME);
                                    String value$ = locator.getProperty(CELL_FIELD_VALUE);
                                    if (name$ != null) {
                                        if (ACTION_COPY_FIELDS.equals(action$))
                                            entity.putElementItem("field", new Core(null, name$, value$));
                                        if (ACTION_CUT_FIELDS.equals(action$)) {
                                            entity.putElementItem("field", new Core(null, name$, value$));
                                            sourceEntihome$ = locator.getProperty(Entigrator.ENTIHOME);
                                            sourceEntigrator = console.getEntigrator(sourceEntihome$);
                                            sourceEntityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                                            sourceEntity = sourceEntigrator.getEntityAtKey(sourceEntityKey$);
                                            sourceEntity.removeElementItem("field", name$);
                                            sourceEntigrator.save(sourceEntity);
                                        }
                                    }
                                }
                            }
                            entigrator.save(entity);
                            Core[] ca = entity.elementGet("field");
                            replaceTable(ca);
                        } catch (Exception ee) {
                            LOGGER.info(ee.toString());
                        }
                    }
                });
                menu.add(pasteItem);
            }
        }

        @Override
        public void menuDeselected(MenuEvent e) {
        }

        @Override
        public void menuCanceled(MenuEvent e) {
        }
    });
    doneItem = new JMenuItem("Done");
    doneItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            save();
            if (requesterResponseLocator$ != null) {
                try {
                    byte[] ba = Base64.decodeBase64(requesterResponseLocator$);
                    String responseLocator$ = new String(ba, "UTF-8");
                    responseLocator$ = Locator.append(responseLocator$, Entigrator.ENTIHOME, entihome$);
                    responseLocator$ = Locator.append(responseLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                    //  System.out.println("FieldsEditor:done.response locator="+responseLocator$);
                    JConsoleHandler.execute(console, responseLocator$);
                } catch (Exception ee) {
                    LOGGER.severe(ee.toString());
                }
            } else
                console.back();
        }
    });
    menu.add(doneItem);
    JMenuItem cancelItem = new JMenuItem("Cancel");
    cancelItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            console.back();
        }
    });
    menu.add(cancelItem);
    menu.addSeparator();
    JMenuItem addItemItem = new JMenuItem("Add item");
    addItemItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            addRow();
        }
    });
    menu.add(addItemItem);
    if (postMenu != null) {
        //System.out.println("JFieldsEditor:postMenu="+postMenu.length);
        for (JMenuItem jmi : postMenu)
            menu.add(jmi);
    }
    //else
    //   System.out.println("JFieldsEditor:postMenu empty");

    return menu;
}

From source file:jatoo.app.App.java

private JPopupMenu getWindowPopup(final Point location) {

    ////from   w  ww.  j  av a2  s .  com
    // hide

    final JMenuItem hideItem = new JMenuItem(getText("popup.hide"));
    hideItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            hide();
        }
    });

    //
    // send to back

    final JMenuItem sendToBackItem = new JMenuItem(getText("popup.send_to_back"));
    sendToBackItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            sendToBack();
        }
    });

    //
    // always on top

    final JCheckBoxMenuItem alwaysOnTopItem = new JCheckBoxMenuItem(getText("popup.always_on_top"),
            isAlwaysOnTop());
    alwaysOnTopItem.addItemListener(new ItemListener() {
        public void itemStateChanged(final ItemEvent e) {
            setAlwaysOnTop(alwaysOnTopItem.isSelected());
        }
    });

    //
    // transparency

    final JSlider transparencySlider = new JSlider(JSlider.VERTICAL, 0, 100, getTransparency());
    transparencySlider.setMajorTickSpacing(25);
    transparencySlider.setMinorTickSpacing(5);
    transparencySlider.setSnapToTicks(true);
    transparencySlider.setPaintTicks(true);
    transparencySlider.setPaintLabels(true);
    transparencySlider.addChangeListener(new ChangeListener() {
        public void stateChanged(final ChangeEvent e) {
            setTransparency(transparencySlider.getValue());
        }
    });

    final JMenu transparencyItem = new JMenu(getText("popup.transparency"));
    transparencyItem.add(transparencySlider);

    //
    // close

    final JMenuItem closeItem = new JMenuItem(getText("popup.close"), getIcon("close-016.png"));
    closeItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            System.exit(0);
        }
    });

    //
    // the popup

    JPopupMenu popup = new JPopupMenu(getTitle());

    popup.add(hideItem);
    popup.addSeparator();
    popup.add(sendToBackItem);
    popup.add(alwaysOnTopItem);
    popup.add(transparencyItem);
    popup.addSeparator();
    popup.add(closeItem);

    popup.setInvoker(popup);
    popup.setLocation(location);

    return popup;
}

From source file:com.orange.atk.graphAnalyser.LectureJATKResult.java

/** This method is called from within the constructor to
 * initialize the form./*from w  w  w .  j  a  va 2s . co m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
    jListGraph = new JList(listModel);
    jComboBoxLeft = new JComboBox(comboModelLeft);
    jComboBoxRight = new JComboBox(comboModelRight);
    jListMarker = new JList(listModelMarker);
    jTable2 = new javax.swing.JTable();
    jMenu1 = new javax.swing.JMenu();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    jComboBoxLeft.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxLeftActionPerformed(evt);
        }
    });

    jComboBoxRight.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxRightActionPerformed(evt);
        }
    });

    jTable2.setModel(modeltable);

    jMenu1.setText("File");

    JMenuItem jMenuItem1 = new JMenuItem();
    jMenuItem1.setText("Open Directory");
    jMenuItem1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            openDirectoryAction(evt);
        }
    });

    JMenuItem jMenuItem2 = new JMenuItem();
    jMenuItem2.setText("Add a reference Graph");
    jMenuItem2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            jMenuItemaddGraphActionPerformed(evt);
        }
    });

    JMenuItem jMenuItem3 = new JMenuItem();
    jMenuItem3.setText("set Graph color");
    jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemChangecolorActionPerformed(evt);
        }
    });

    JMenuItem jMenuItem4 = new JMenuItem();
    jMenuItem4.setText("save config file");
    jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemSaveConfigFileActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem1);
    jMenu1.add(jMenuItem2);
    jMenu1.add(jMenuItem3);
    jMenu1.add(jMenuItem4);

    JMenuBar jMenuBar1 = new JMenuBar();
    jMenuBar1.add(jMenu1);

    setJMenuBar(jMenuBar1);

    //organise JFRAME
    JPanel mainpanel = (JPanel) getContentPane();
    mainpanel.setLayout(new BorderLayout());

    mainpanel.add(chartPanel, BorderLayout.CENTER);

    JPanel toolPanel = new JPanel();
    toolPanel.setLayout(new FlowLayout());

    toolPanel.add(jComboBoxLeft);

    Box graphbox = Box.createVerticalBox();
    graphbox.add(new JLabel("List of Graph "));
    JScrollPane jspaneGraph = new JScrollPane();
    jspaneGraph.setViewportView(jListGraph);
    jspaneGraph.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jspaneGraph.setPreferredSize(new Dimension(150, 100));

    graphbox.add(jspaneGraph);
    //      graphbox.setBorder(BorderFactory.createLineBorder(Color.black));
    toolPanel.add(graphbox);

    Box markerbox = Box.createVerticalBox();
    markerbox.add(new JLabel("List of Marker"));
    JScrollPane jspaneMarker = new JScrollPane();
    jspaneMarker.setViewportView(jListMarker);
    jspaneMarker.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jspaneMarker.setPreferredSize(new Dimension(150, 100));
    markerbox.add(jspaneMarker);
    //      markerbox.setBorder(BorderFactory.createLineBorder(Color.black));
    toolPanel.add(markerbox);

    JScrollPane jspane = new JScrollPane();
    jspane.setViewportView(jTable2);
    jspane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jspane.setPreferredSize(new Dimension(300, 100));
    toolPanel.add(jspane);
    toolPanel.add(jComboBoxRight);

    mainpanel.add(toolPanel, BorderLayout.NORTH);

    pack();
}

From source file:com.ln.gui.Main.java

@SuppressWarnings("unchecked")
public Main() {/*  w  ww . j av  a  2  s .  c om*/
    System.gc();
    setIconImage(Toolkit.getDefaultToolkit().getImage(Configuration.mydir + "\\resources\\icons\\ln6464.png"));
    DateFormat dd = new SimpleDateFormat("dd");
    DateFormat dh = new SimpleDateFormat("HH");
    DateFormat dm = new SimpleDateFormat("mm");
    Date day = new Date();
    Date hour = new Date();
    Date minute = new Date();
    dayd = Integer.parseInt(dd.format(day));
    hourh = Integer.parseInt(dh.format(hour));
    minutem = Integer.parseInt(dm.format(minute));
    setTitle("Liquid Notify Revision 2");
    Description.setBackground(Color.WHITE);
    Description.setContentType("text/html");
    Description.setEditable(false);
    Getcalendar.Main();
    HyperlinkListener hyperlinkListener = new ActivatedHyperlinkListener(f, Description);
    Description.addHyperlinkListener(hyperlinkListener);
    //Add components
    setContentPane(contentPane);
    setJMenuBar(menuBar);
    contentPane.setLayout(
            new MigLayout("", "[220px:230.00:220,grow][209.00px:n:5000,grow]", "[22px][][199.00,grow][grow]"));
    eventsbtn.setToolTipText("Displays events currently set to notify");
    eventsbtn.setMinimumSize(new Dimension(220, 23));
    eventsbtn.setMaximumSize(new Dimension(220, 23));
    contentPane.add(eventsbtn, "cell 0 0");
    NewsArea.setBackground(Color.WHITE);
    NewsArea.setBorder(new BevelBorder(BevelBorder.LOWERED, Color.LIGHT_GRAY, Color.LIGHT_GRAY, Color.DARK_GRAY,
            Color.DARK_GRAY));
    NewsArea.setMinimumSize(new Dimension(20, 22));
    NewsArea.setMaximumSize(new Dimension(10000, 22));
    contentPane.add(NewsArea, "cell 1 0,growx,aligny top");
    menuBar.add(File);
    JMenuItem Settings = new JMenuItem("Settings");
    Settings.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\settings.png"));
    Settings.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Settings setup = new Settings();
            setup.setVisible(true);
            setup.setLocationRelativeTo(rootPane);
        }
    });
    File.add(Settings);
    File.add(mntmNewMenuItem);
    Tray.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\ln1616.png"));
    File.add(Tray);
    Exit.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\exit.png"));
    File.add(Exit);

    menuBar.add(mnNewMenu);

    Update.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\update.png"));
    Update.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                URL localURL = new URL("http://jiiks.net23.net/tlnotify/online.html");
                URLConnection localURLConnection = localURL.openConnection();
                BufferedReader localBufferedReader = new BufferedReader(
                        new InputStreamReader(localURLConnection.getInputStream()));
                String str = localBufferedReader.readLine();
                if (!str.contains("YES")) {
                    String st2221 = "Updates server appears to be offline";
                    JOptionPane pane1 = new JOptionPane(st2221, JOptionPane.WARNING_MESSAGE,
                            JOptionPane.DEFAULT_OPTION);
                    JDialog dialog1 = pane1.createDialog("Update");
                    dialog1.setLocationRelativeTo(null);
                    dialog1.setVisible(true);
                    dialog1.setAlwaysOnTop(true);
                } else if (str.contains("YES")) {
                    URL localURL2 = new URL("http://jiiks.net23.net/tlnotify/latestversion.html");
                    URLConnection localURLConnection1 = localURL2.openConnection();
                    BufferedReader localBufferedReader2 = new BufferedReader(
                            new InputStreamReader(localURLConnection1.getInputStream()));
                    String str2 = localBufferedReader2.readLine();
                    Updatechecker.latestver = str2;
                    if (Integer.parseInt(str2) <= Configuration.version) {
                        String st2221 = "No updates available =(";
                        JOptionPane pane1 = new JOptionPane(st2221, JOptionPane.WARNING_MESSAGE,
                                JOptionPane.DEFAULT_OPTION);
                        JDialog dialog1 = pane1.createDialog("Update");
                        dialog1.setLocationRelativeTo(null);
                        dialog1.setVisible(true);
                        dialog1.setAlwaysOnTop(true);
                    } else if (Integer.parseInt(str2) > Configuration.version) {
                        String st2221 = "Updates available!";
                        JOptionPane pane1 = new JOptionPane(st2221, JOptionPane.WARNING_MESSAGE,
                                JOptionPane.DEFAULT_OPTION);
                        JDialog dialog1 = pane1.createDialog("Update");
                        dialog1.setLocationRelativeTo(null);
                        dialog1.setVisible(true);
                        dialog1.setAlwaysOnTop(true);

                        Updatechecker upd = new Updatechecker();
                        upd.setVisible(true);
                        upd.setLocationRelativeTo(rootPane);
                        upd.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                    }
                }
            } catch (MalformedURLException e1) {
                e1.printStackTrace();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

        }

    });
    mnNewMenu.add(Update);
    JMenuItem About = new JMenuItem("About");
    About.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\about.png"));
    About.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            About a = new About();
            a.setVisible(true);
            a.setLocationRelativeTo(rootPane);
            a.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        }
    });
    mnNewMenu.add(About);
    JMenuItem Github = new JMenuItem("Github");
    Github.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\github.png"));
    Github.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String url = "https://github.com/Jiiks/Liquid-Notify-Rev2";
            try {
                java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    });
    mnNewMenu.add(Github);
    JMenuItem Thread = new JMenuItem("Thread");
    Thread.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\liquid.png"));
    Thread.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String url = "http://www.teamliquid.net/forum/viewmessage.php?topic_id=318184";
            try {
                java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    });
    mnNewMenu.add(Thread);
    Refreshbtn.setToolTipText("Refreshes calendar, please don't spam ^_^");
    Refreshbtn.setPreferredSize(new Dimension(90, 20));
    Refreshbtn.setMinimumSize(new Dimension(100, 20));
    Refreshbtn.setMaximumSize(new Dimension(100, 20));
    contentPane.add(Refreshbtn, "flowx,cell 0 1,alignx left");
    //Components to secondary panel   
    Titlebox = new JComboBox();
    contentPane.add(Titlebox, "cell 1 1,growx,aligny top");
    Titlebox.setMinimumSize(new Dimension(20, 20));
    Titlebox.setMaximumSize(new Dimension(10000, 20));
    //Set other
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 686, 342);
    contentPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    NewsArea.setEnabled(false);
    NewsArea.setEditable(false);
    NewsArea.setText("News: " + News);
    contentPane.add(panel, "cell 0 2,grow");
    panel.setLayout(null);
    final JCalendar calendar = new JCalendar();
    calendar.getMonthChooser().setPreferredSize(new Dimension(120, 20));
    calendar.getMonthChooser().setMinimumSize(new Dimension(120, 24));
    calendar.getYearChooser().setLocation(new Point(20, 0));
    calendar.getYearChooser().setMaximum(100);
    calendar.getYearChooser().setMaximumSize(new Dimension(100, 2147483647));
    calendar.getYearChooser().setMinimumSize(new Dimension(50, 20));
    calendar.getYearChooser().setPreferredSize(new Dimension(50, 20));
    calendar.getYearChooser().getSpinner().setPreferredSize(new Dimension(100, 20));
    calendar.getYearChooser().getSpinner().setMinimumSize(new Dimension(100, 20));
    calendar.getMonthChooser().getSpinner().setPreferredSize(new Dimension(119, 20));
    calendar.getMonthChooser().getSpinner().setMinimumSize(new Dimension(120, 24));
    calendar.getDayChooser().getDayPanel().setFont(new Font("Tahoma", Font.PLAIN, 11));
    calendar.setDecorationBordersVisible(true);
    calendar.setTodayButtonVisible(true);
    calendar.setBackground(Color.LIGHT_GRAY);
    calendar.setBounds(0, 0, 220, 199);
    calendar.getDate();
    calendar.setWeekOfYearVisible(false);
    calendar.setDecorationBackgroundVisible(false);
    calendar.setMaxDayCharacters(2);
    calendar.getDayChooser().setFont(new Font("Tahoma", Font.PLAIN, 10));
    panel.add(calendar);
    Descriptionscrollpane.setLocation(new Point(100, 100));
    Descriptionscrollpane.setMaximumSize(new Dimension(10000, 10000));
    Descriptionscrollpane.setMinimumSize(new Dimension(20, 200));
    Description.setLocation(new Point(100, 100));
    Description.setBorder(new BevelBorder(BevelBorder.LOWERED, Color.LIGHT_GRAY, Color.LIGHT_GRAY,
            Color.DARK_GRAY, Color.DARK_GRAY));
    Description.setMaximumSize(new Dimension(1000, 400));
    Description.setMinimumSize(new Dimension(400, 200));
    contentPane.add(Descriptionscrollpane, "cell 1 2 1 2,growx,aligny top");
    Descriptionscrollpane.setViewportView(Description);
    verticalStrut.setMinimumSize(new Dimension(12, 20));
    contentPane.add(verticalStrut, "cell 0 1");
    Notify.setToolTipText("Adds selected event to notify event list.");
    Notify.setHorizontalTextPosition(SwingConstants.CENTER);
    Notify.setPreferredSize(new Dimension(100, 20));
    Notify.setMinimumSize(new Dimension(100, 20));
    Notify.setMaximumSize(new Dimension(100, 20));
    contentPane.add(Notify, "cell 0 1,alignx right");
    calendar.getMonthChooser().addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            month = calendar.getMonthChooser().getMonth();
            Parser.parse();
        }
    });

    calendar.getDayChooser().addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            try {
                int h = calendar.getMonthChooser().getMonth();
                @SuppressWarnings("deprecation")
                int date = calendar.getDate().getDate();
                int month = calendar.getMonthChooser().getMonth() + 1;
                globmonth = calendar.getMonthChooser().getMonth();
                sdate = date;
                datestring = Integer.toString(sdate);
                monthstring = Integer.toString(month);
                String[] Hours = Betaparser.Hours;
                String[] Titles = Betaparser.STitle;
                String[] Full = new String[Hours.length];
                String[] Minutes = Betaparser.Minutes;
                String[] Des = Betaparser.Description;
                String[] Des2 = new String[Betaparser.Description.length];
                String Seconds = "00";
                String gg;
                int[] IntHours = new int[Hours.length];
                int[] IntMins = new int[Hours.length];
                int Events = 0;
                monthday = monthstring + "|" + datestring + "|";
                Titlebox.removeAllItems();
                for (int a = 0; a != Hours.length; a++) {
                    IntHours[a] = Integer.parseInt(Hours[a]);
                    IntMins[a] = Integer.parseInt(Minutes[a]);
                }
                for (int i1 = 0; i1 != Hours.length; i1++) {
                    if (Betaparser.Events[i1].startsWith(monthday)) {
                        Full[i1] = String.format("%02d:%02d", IntHours[i1], IntMins[i1]) + " | " + Titles[i1];
                        Titlebox.addItem(Full[i1]);
                    }
                }
            } catch (Exception e1) {
                //Catching mainly due to boot property change            
            }
        }
    });
    Image image = Toolkit.getDefaultToolkit().getImage(Configuration.mydir + "\\resources\\icons\\ln1616.png");
    final SystemTray tray = SystemTray.getSystemTray();
    ActionListener listener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setVisible(true);
        }
    };
    PopupMenu popup = new PopupMenu();
    MenuItem defaultItem = new MenuItem();
    defaultItem.addActionListener(listener);
    TrayIcon trayIcon = null;
    trayIcon = new TrayIcon(image, "LiquidNotify Revision 2", popup);

    trayIcon.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            setVisible(true);
        }
    });//
    try {
        tray.add(trayIcon);
    } catch (AWTException e) {
        System.err.println(e);
    }
    if (trayIcon != null) {
        trayIcon.setImage(image);
    }

    Tray.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
        }
    });

    Titlebox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Descparser.parsedesc();
        }
    });

    Refreshbtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Getcalendar.Main();
            Descparser.parsedesc();
        }
    });

    Notify.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            NOTIFY = Descparser.TTT;
            NOTIFYD = Descparser.DDD;
            NOTIFYH = Descparser.HHH;
            NOTIFYM = Descparser.MMM;
            int i = events;
            NOA[i] = NOTIFY;
            NOD[i] = NOTIFYD;
            NOH[i] = NOTIFYH;
            NOM[i] = NOTIFYM;
            Eventlist[i] = "Starts in: " + Integer.toString(NOD[i]) + " Days " + Integer.toString(NOH[i])
                    + " Hours " + Integer.toString(NOM[i]) + " Minutes " + " | " + NOA[i];
            events = events + 1;
            Notifylist si = new Notifylist();
            si.setVisible(false);
            si.setBounds(1, 1, 1, 1);
            si.dispose();
            if (thread.getState().name().equals("PENDING")) {
                thread.execute();
            }
        }
    });
    eventsbtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Notifylist list = new Notifylist();
            if (played == 1) {
                asd.close();
                played = 0;
            }
            list.setVisible(true);
            list.setLocationRelativeTo(rootPane);
            list.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        }
    });

    mntmNewMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (thread.getState().name().equals("PENDING")) {
                thread.execute();
            }
            Userstreams us = new Userstreams();
            us.setVisible(true);
            us.setLocationRelativeTo(rootPane);
        }
    });

    Exit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            //Absolute exit
            JOptionPane.showMessageDialog(rootPane, "Bye bye :(", "Exit", JOptionPane.INFORMATION_MESSAGE);
            Runtime ln = Runtime.getRuntime();
            ln.gc();
            final Frame[] allf = Frame.getFrames();
            final Window[] allw = Window.getWindows();
            for (final Window allwindows : allw) {
                allwindows.dispose();
            }
            for (final Frame allframes : allf) {
                allframes.dispose();
                System.exit(0);
            }
        }
    });
}

From source file:coreferenceresolver.gui.MarkupGUI.java

public MarkupGUI() throws IOException {
    highlightPainters = new ArrayList<>();

    for (int i = 0; i < COLORS.length; ++i) {
        DefaultHighlighter.DefaultHighlightPainter highlightPainter = new DefaultHighlighter.DefaultHighlightPainter(
                COLORS[i]);/*from   w  ww  . ja v a2 s  .c om*/
        highlightPainters.add(highlightPainter);
    }

    defaulPath = FileUtils.readFileToString(new File(".\\src\\coreferenceresolver\\gui\\defaultpath"));
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setLayout(new BorderLayout());
    this.setSize(java.awt.Toolkit.getDefaultToolkit().getScreenSize());

    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    //create menu items
    JMenuItem importMenuItem = new JMenuItem("Import");

    JMenuItem exportMenuItem = new JMenuItem("Export");

    fileMenu.add(importMenuItem);
    fileMenu.add(exportMenuItem);

    menuBar.add(fileMenu);

    this.setJMenuBar(menuBar);

    ScrollablePanel mainPanel = new ScrollablePanel();
    mainPanel.setScrollableWidth(ScrollablePanel.ScrollableSizeHint.NONE);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    //IMPORT BUTTON
    importMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //                MarkupGUI.reviewElements.clear();
            //                MarkupGUI.markupReviews.clear();                
            JFileChooser markupFileChooser = new JFileChooser(defaulPath);
            markupFileChooser.setDialogTitle("Choose your markup file");
            markupFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

            if (markupFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
                final JDialog d = new JDialog();
                JPanel p1 = new JPanel(new GridBagLayout());
                p1.add(new JLabel("Please Wait..."), new GridBagConstraints());
                d.getContentPane().add(p1);
                d.setSize(100, 100);
                d.setLocationRelativeTo(null);
                d.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
                d.setModal(true);

                SwingWorker<?, ?> worker = new SwingWorker<Void, Void>() {
                    protected Void doInBackground() throws IOException, BadLocationException {
                        readMarkupFile(markupFileChooser.getSelectedFile().getAbsolutePath());
                        for (int i = 0; i < markupReviews.size(); ++i) {
                            mainPanel.add(newReviewPanel(markupReviews.get(i), i));
                        }
                        return null;
                    }

                    protected void done() {
                        MarkupGUI.this.revalidate();
                        d.dispose();
                    }
                };
                worker.execute();
                d.setVisible(true);
            } else {
                return;
            }
        }
    });

    //EXPORT BUTTON: GET NEW VALUE (REF, TYPE) OF NPs      
    exportMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser markupFileChooser = new JFileChooser(defaulPath);
            markupFileChooser.setDialogTitle("Choose where your markup file saved");
            markupFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

            if (markupFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
                final JDialog d = new JDialog();
                JPanel p1 = new JPanel(new GridBagLayout());
                p1.add(new JLabel("Please Wait..."), new GridBagConstraints());
                d.getContentPane().add(p1);
                d.setSize(100, 100);
                d.setLocationRelativeTo(null);
                d.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
                d.setModal(true);

                SwingWorker<?, ?> worker = new SwingWorker<Void, Void>() {
                    protected Void doInBackground() throws IOException {
                        for (Review review : markupReviews) {
                            generateNPsRef(review);
                        }
                        int i = 0;
                        for (ReviewElement reviewElement : reviewElements) {
                            int j = 0;
                            for (Element element : reviewElement.elements) {
                                String newType = element.typeSpinner.getValue().toString();
                                if (newType.equals("Object")) {
                                    markupReviews.get(i).getNounPhrases().get(j).setType(0);
                                } else if (newType.equals("Attribute")) {
                                    markupReviews.get(i).getNounPhrases().get(j).setType(3);
                                } else if (newType.equals("Other")) {
                                    markupReviews.get(i).getNounPhrases().get(j).setType(1);
                                } else if (newType.equals("Candidate")) {
                                    markupReviews.get(i).getNounPhrases().get(j).setType(2);
                                }
                                ++j;
                            }
                            ++i;
                        }
                        initMarkupFile(markupFileChooser.getSelectedFile().getAbsolutePath() + File.separator
                                + "markup.out.txt");
                        return null;
                    }

                    protected void done() {
                        d.dispose();
                        try {
                            Desktop.getDesktop()
                                    .open(new File(markupFileChooser.getSelectedFile().getAbsolutePath()));
                        } catch (IOException ex) {
                            Logger.getLogger(MarkupGUI.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    }
                };
                worker.execute();
                d.setVisible(true);
            } else {
                return;
            }
        }
    });

    JScrollPane scrollMainPane = new JScrollPane(mainPanel);
    scrollMainPane.getVerticalScrollBar().setUnitIncrement(16);
    scrollMainPane.setPreferredSize(new Dimension(this.getWidth(), this.getHeight()));
    scrollMainPane.setSize(this.getWidth(), this.getHeight());
    this.setResizable(false);
    this.add(scrollMainPane, BorderLayout.CENTER);
    this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    this.pack();
}

From source file:au.org.ala.delta.editor.DeltaEditor.java

private JMenuBar buildMenus() {

    JMenuBar menuBar = new JMenuBar();

    // File menu. This on is kind of special, in that it gets rebuilt each
    // time a file is opened.
    _fileMenu = new JMenu();
    _fileMenu.setName("mnuFile");
    buildFileMenu(_fileMenu);//from ww  w. j  a v  a2  s. c  o  m
    menuBar.add(_fileMenu);

    // Edit Menu
    JMenu mnuEdit = buildEditMenu();
    menuBar.add(mnuEdit);

    // Search Menu
    JMenu mnuSearch = buildSearchMenu();
    menuBar.add(mnuSearch);

    // View Menu
    JMenu mnuView = buildViewMenu();

    menuBar.add(mnuView);

    // Window menu
    _windowMenu = new JMenu();
    _windowMenu.setName("mnuWindow");
    buildWindowMenu(_windowMenu);
    menuBar.add(_windowMenu);

    JMenu mnuHelp = new JMenu();
    mnuHelp.setName("mnuHelp");
    JMenuItem mnuItHelpContents = new JMenuItem();
    mnuItHelpContents.setName("mnuItHelpContents");
    mnuHelp.add(mnuItHelpContents);
    mnuItHelpContents.addActionListener(_helpController.helpAction());

    JMenuItem mnuItHelpOnSelection = new JMenuItem(IconHelper.createImageIcon("help_cursor.png"));
    mnuItHelpOnSelection.setName("mnuItHelpOnSelection");

    mnuItHelpOnSelection.addActionListener(_helpController.helpOnSelectionAction());
    mnuHelp.add(mnuItHelpOnSelection);

    javax.swing.Action openAboutAction = _actionMap.get("openAbout");

    if (isMac()) {
        configureMacAboutBox(openAboutAction);
    } else {
        JMenuItem mnuItAbout = new JMenuItem();
        mnuItAbout.setAction(openAboutAction);
        mnuHelp.addSeparator();
        mnuHelp.add(mnuItAbout);
    }
    menuBar.add(mnuHelp);

    return menuBar;
}

From source file:net.chaosserver.timelord.swingui.TimelordMenu.java

/**
 * Creates a new instance of the help menu.
 *
 * @return the new help menu//from   w  w w . j a v a 2s .c o  m
 */
protected JMenu createHelpMenu() {
    JMenuItem menuItem;
    JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    this.add(helpMenu);

    menuItem = new JMenuItem("Help Topics", KeyEvent.VK_H);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_H, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

    try {
        URL hsURL = HelpSet.findHelpSet(this.getClass().getClassLoader(),
                "net/chaosserver/timelord/help/TimelordHelp.hs");
        HelpSet hs = new HelpSet(null, hsURL);
        HelpBroker hb = hs.createHelpBroker();
        menuItem.addActionListener(new CSH.DisplayHelpFromSource(hb));
    } catch (HelpSetException e) {
        menuItem.setEnabled(false);
    }

    // menuItem.setActionCommand(ACTION_ABOUT);
    helpMenu.add(menuItem);

    menuItem = new JMenuItem("Log Window");
    menuItem.setActionCommand(ACTION_LOG);
    menuItem.addActionListener(this);
    menuItem.setEnabled(false);
    helpMenu.add(menuItem);

    menuItem = new JMenuItem("Cause Memory Leak");
    menuItem.setActionCommand(ACTION_LEAK);
    menuItem.addActionListener(this);
    menuItem.setEnabled(false);
    helpMenu.add(menuItem);

    if (!OsUtil.isMac()) {
        helpMenu.addSeparator();

        menuItem = new JMenuItem("About Timelord", KeyEvent.VK_A);
        menuItem.setActionCommand(ACTION_ABOUT);
        menuItem.addActionListener(this);
        helpMenu.add(menuItem);
    }

    return helpMenu;
}

From source file:net.itransformers.topologyviewer.gui.GraphViewerPanel.java

private <T extends JComponent> void fillRightClickMenu(final String[] varr,
        java.util.List<RightClickItemType> rightClickItem, T popup) {
    for (final RightClickItemType rcItemType : rightClickItem) {
        JMenuItem sendCmd = new JMenuItem(rcItemType.getName());
        sendCmd.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e1) {
                try {
                    final Map<String, GraphMLMetadata<String>> vertexMetadatas = graphmlLoader
                            .getVertexMetadatas();
                    for (String v : varr) {
                        GraphViewerPanel.this.Animator(v.toString());
                        rightClickInvoker.invokeRightClickHandler(GraphViewerPanel.this.parent, v, rcItemType,
                                vertexMetadatas, path, versionDir);
                    }/*from   ww  w  .ja va 2 s.  c  o m*/
                } catch (Exception e2) {
                    e2.printStackTrace();
                    JOptionPane.showMessageDialog(GraphViewerPanel.this,
                            "Error while calling right click: " + e2.getMessage());
                }
            }
        });
        popup.add(sendCmd);
        final java.util.List<SubMenuType> submenu1 = rcItemType.getSubmenu();
        for (SubMenuType subMenuType : submenu1) {
            JMenu submenu = new JMenu(subMenuType.getName());
            java.util.List<RightClickItemType> submenuItems = subMenuType.getRightClickItem();
            popup.add(submenu);
            fillRightClickMenu(varr, submenuItems, submenu);
        }
    }
}

From source file:gdt.jgui.entity.folder.JFolderPanel.java

/**
 * Get the context menu./*www.  ja va2  s. c  om*/
 * @return the context menu.
 */
@Override
public JMenu getContextMenu() {
    menu = super.getContextMenu();
    mia = null;
    int cnt = menu.getItemCount();
    if (cnt > 0) {
        mia = new JMenuItem[cnt];
        for (int i = 0; i < cnt; i++)
            mia[i] = menu.getItem(i);
    }
    menu.addMenuListener(new MenuListener() {
        @Override
        public void menuSelected(MenuEvent e) {
            //System.out.println("EntitiesPanel:getConextMenu:menu selected");
            menu.removeAll();
            if (mia != null) {
                for (JMenuItem mi : mia)
                    menu.add(mi);
                menu.addSeparator();
            }
            JMenuItem refreshItem = new JMenuItem("Refresh");
            refreshItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JConsoleHandler.execute(console, locator$);
                }
            });
            menu.add(refreshItem);
            JMenuItem openItem = new JMenuItem("Open folder");
            openItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        File folder = new File(entihome$ + "/" + entityKey$);
                        if (!folder.exists())
                            folder.mkdir();
                        Desktop.getDesktop().open(folder);
                    } catch (Exception ee) {
                        LOGGER.severe(ee.toString());
                    }
                }
            });
            menu.add(openItem);
            JMenuItem importItem = new JMenuItem("Import");
            importItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        File home = new File(System.getProperty("user.home"));
                        Desktop.getDesktop().open(home);
                    } catch (Exception ee) {
                        LOGGER.severe(ee.toString());
                    }
                }
            });

            menu.add(importItem);
            JMenuItem newItem = new JMenuItem("New text");
            newItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        JTextEditor textEditor = new JTextEditor();
                        String teLocator$ = textEditor.getLocator();
                        teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                        String text$ = "New" + Identity.key().substring(0, 4) + ".txt";
                        teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, text$);
                        JFolderPanel fp = new JFolderPanel();
                        String fpLocator$ = fp.getLocator();
                        fpLocator$ = Locator.append(fpLocator$, Entigrator.ENTIHOME, entihome$);
                        fpLocator$ = Locator.append(fpLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                        fpLocator$ = Locator.append(fpLocator$, BaseHandler.HANDLER_METHOD, "response");
                        fpLocator$ = Locator.append(fpLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_CREATE_FILE);
                        String requesterResponseLocator$ = Locator.compressText(fpLocator$);
                        teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                requesterResponseLocator$);
                        JConsoleHandler.execute(console, teLocator$);
                    } catch (Exception ee) {
                        LOGGER.severe(ee.toString());
                    }
                }
            });

            menu.add(newItem);
            //menu.addSeparator();
            if (hasToInsert()) {
                menu.addSeparator();
                JMenuItem insertItem = new JMenuItem("Insert");
                insertItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                            Transferable clipboardContents = systemClipboard.getContents(null);
                            if (clipboardContents == null)
                                return;
                            Object transferData = clipboardContents
                                    .getTransferData(DataFlavor.javaFileListFlavor);
                            List<File> files = (List<File>) transferData;
                            for (int i = 0; i < files.size(); i++) {
                                File file = (File) files.get(i);
                                if (file.exists() && file.isFile()) {
                                    System.out.println("FolderPanel:insert:in=" + file.getPath());
                                    File dir = new File(entihome$ + "/" + entityKey$);
                                    if (!dir.exists())
                                        dir.mkdir();
                                    File out = new File(entihome$ + "/" + entityKey$ + "/" + file.getName());
                                    if (!out.exists())
                                        out.createNewFile();
                                    System.out.println("FolderPanel:insert:out=" + out.getPath());
                                    FileExpert.copyFile(file, out);
                                    JConsoleHandler.execute(console, getLocator());
                                }

                                //      System.out.println("FolderPanel:import:file="+file.getPath());
                            }
                        } catch (Exception ee) {
                            LOGGER.severe(ee.toString());

                        }

                    }
                });
                menu.add(insertItem);
            }
            if (hasToPaste()) {
                menu.addSeparator();
                JMenuItem pasteItem = new JMenuItem("Paste");
                pasteItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        String[] sa = console.clipboard.getContent();
                        Properties locator;
                        String file$;
                        File file;
                        File target;
                        String dir$ = entihome$ + "/" + entityKey$;
                        File dir = new File(dir$);
                        if (!dir.exists())
                            dir.mkdir();
                        for (String aSa : sa) {
                            try {
                                locator = Locator.toProperties(aSa);
                                if (LOCATOR_TYPE_FILE.equals(locator.getProperty(Locator.LOCATOR_TYPE))) {
                                    file$ = locator.getProperty(FILE_PATH);
                                    file = new File(file$);
                                    target = new File(dir$ + "/" + file.getName());
                                    if (!target.exists())
                                        target.createNewFile();
                                    FileExpert.copyFile(file, target);
                                }
                            } catch (Exception ee) {
                                LOGGER.info(ee.toString());
                            }
                        }
                        JConsoleHandler.execute(console, locator$);
                    }
                });
                menu.add(pasteItem);
            }
            if (hasSelectedItems()) {
                menu.addSeparator();
                JMenuItem deleteItem = new JMenuItem("Delete");
                deleteItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?",
                                "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                        if (response == JOptionPane.YES_OPTION) {
                            String[] sa = JFolderPanel.this.listSelectedItems();
                            if (sa == null)
                                return;
                            Properties locator;
                            String file$;
                            File file;
                            for (String aSa : sa) {
                                locator = Locator.toProperties(aSa);
                                file$ = locator.getProperty(FILE_PATH);
                                file = new File(file$);
                                try {
                                    if (file.isDirectory())
                                        FileExpert.clear(file$);
                                    file.delete();
                                } catch (Exception ee) {
                                    LOGGER.info(ee.toString());
                                }
                            }
                        }
                        JConsoleHandler.execute(console, locator$);
                    }
                });
                menu.add(deleteItem);
                JMenuItem copyItem = new JMenuItem("Copy");
                copyItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        String[] sa = JFolderPanel.this.listSelectedItems();
                        console.clipboard.clear();
                        if (sa != null)
                            for (String aSa : sa)
                                console.clipboard.putString(aSa);
                    }
                });
                menu.add(copyItem);
                JMenuItem exportItem = new JMenuItem("Export");
                exportItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            String[] sa = JFolderPanel.this.listSelectedItems();
                            Properties locator;
                            String file$;
                            File file;
                            ArrayList<File> fileList = new ArrayList<File>();
                            for (String aSa : sa) {
                                try {
                                    locator = Locator.toProperties(aSa);
                                    file$ = locator.getProperty(FILE_PATH);
                                    file = new File(file$);
                                    fileList.add(file);
                                } catch (Exception ee) {
                                    LOGGER.severe(ee.toString());
                                }
                            }
                            File[] fa = fileList.toArray(new File[0]);
                            if (fa.length < 1)
                                return;
                            //                             System.out.println("Folderpanel:finish:list="+fa.length);
                            JFileChooser chooser = new JFileChooser();
                            chooser.setCurrentDirectory(new java.io.File(System.getProperty("user.home")));
                            chooser.setDialogTitle("Export files");
                            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                            chooser.setAcceptAllFileFilterUsed(false);
                            if (chooser.showSaveDialog(JFolderPanel.this) == JFileChooser.APPROVE_OPTION) {
                                String dir$ = chooser.getSelectedFile().getPath();
                                File target;
                                for (File f : fa) {
                                    target = new File(dir$ + "/" + f.getName());
                                    if (!target.exists())
                                        target.createNewFile();
                                    FileExpert.copyFile(f, target);
                                }
                            } else {
                                Logger.getLogger(JMainConsole.class.getName()).info(" no selection");
                            }
                            //                            System.out.println("Folderpanel:finish:list="+fileList.size());  
                        } catch (Exception eee) {
                            LOGGER.severe(eee.toString());
                        }
                    }
                });
                menu.add(exportItem);
            }
        }

        @Override
        public void menuDeselected(MenuEvent e) {
        }

        @Override
        public void menuCanceled(MenuEvent e) {
        }
    });
    return menu;
}