Example usage for javax.swing JPopupMenu JPopupMenu

List of usage examples for javax.swing JPopupMenu JPopupMenu

Introduction

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

Prototype

public JPopupMenu() 

Source Link

Document

Constructs a JPopupMenu without an "invoker".

Usage

From source file:ru.goodfil.catalog.ui.forms.FiltersPanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - ???? ??????
    panel2 = new JPanel();
    panel12 = new JPanel();
    label5 = new JLabel();
    tbFilterCode = new JTextField();
    btnSearchFilter = new JButton();
    panel13 = new JPanel();
    hSpacer1 = new JPanel(null);
    btnJoinFilters = new JButton();
    btnCreateFilter = new JButton();
    btnEditFilter = new JButton();
    btnRemoveFilter = new JButton();
    srcTblFilters = new JScrollPane();
    tblFilters = new JTable();
    panel15 = new JPanel();
    label6 = new JLabel();
    cbManufactors = new JComboBox();
    label7 = new JLabel();
    cbSeria = new JComboBox();
    btnClearSearchModel = new JButton();
    btnSearchMotors = new JButton();
    panel1 = new JPanel();
    label1 = new JLabel();
    tbSeria = new JTextField();
    label2 = new JLabel();
    tbModel = new JTextField();
    label3 = new JLabel();
    tbEngine = new JTextField();
    label4 = new JLabel();
    tbDateF = new JTextField();
    label9 = new JLabel();
    tbDateT = new JTextField();
    scrollPane11 = new JScrollPane();
    tblMotors = new JTable();
    panel18 = new JPanel();
    btnAttachMotor = new JButton();
    btnDetachMotor = new JButton();
    vSpacer2 = new JPanel(null);
    scrollPane12 = new JScrollPane();
    tblAllMotors = new JTable();
    panel16 = new JPanel();
    hSpacer3 = new JPanel(null);
    panel17 = new JPanel();
    label8 = new JLabel();
    tbOe = new JTextField();
    btnOeSearch = new JButton();
    scrollPane7 = new JScrollPane();
    tblOes = new JTable();
    panel19 = new JPanel();
    btnAttachOe = new JButton();
    btnDetachOe = new JButton();
    vSpacer3 = new JPanel(null);
    scrollPane8 = new JScrollPane();
    tblAllOes = new JTable();
    tablesPopupMenu = new JPopupMenu();
    miFullCopyToExcel = new JMenuItem();
    menu1 = new JMenu();
    miCopySelectedToExcel = new JMenuItem();
    miCopyToExcel = new JMenuItem();
    menu2 = new JMenu();
    miCopySelectedToBuffer = new JMenuItem();
    miCopyToBuffer = new JMenuItem();
    miPasteFromBuffer = new JMenuItem();
    miShowOnSiteMenu = new JMenu();
    miShowOnSite = new JMenuItem();
    miDontShowOnSite = new JMenuItem();
    miApplyToAllMenu = new JMenu();
    miApplyToVT1 = new JMenuItem();
    miApplyToVT2 = new JMenuItem();
    miApplyToVT3 = new JMenuItem();
    miApplyToVT4 = new JMenuItem();
    miDontApplyToAll = new JMenuItem();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setMinimumSize(new Dimension(300, 207));

    // JFormDesigner evaluation mark
    setBorder(/*from ww  w . ja  v  a2 s. co  m*/
            new javax.swing.border.CompoundBorder(
                    new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                            "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                            javax.swing.border.TitledBorder.BOTTOM,
                            new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                    getBorder()));
    addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent e) {
            if ("border".equals(e.getPropertyName()))
                throw new RuntimeException();
        }
    });

    setLayout(new FormLayout("default:grow", "fill:default:grow"));

    //======== panel2 ========
    {
        panel2.setLayout(new FormLayout("default:grow, $lcgap, 21dlu, $lcgap, default:grow",
                "default, default:grow, $lgap, default, fill:default:grow, $lgap, default, fill:default:grow"));

        //======== panel12 ========
        {
            panel12.setLayout(new FormLayout("default, default:grow, 21dlu", "default"));

            //---- label5 ----
            label5.setText("\u0418\u0437\u0434\u0435\u043b\u0438\u0435");
            panel12.add(label5, cc.xy(1, 1));

            //---- tbFilterCode ----
            tbFilterCode.setToolTipText(
                    "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430");
            tbFilterCode.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tbFilterCodeKeyPressed(e);
                }

                @Override
                public void keyTyped(KeyEvent e) {
                    tbFilterCodeKeyPressed(e);
                }
            });
            tbFilterCode.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    tbFilterCodeFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    tbFilterCodeFocusGained(e);
                }
            });
            panel12.add(tbFilterCode, cc.xy(2, 1));

            //---- btnSearchFilter ----
            btnSearchFilter.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/find_next_24.png")));
            btnSearchFilter.setToolTipText("\u041f\u043e\u0438\u0441\u043a");
            btnSearchFilter.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnSearchFilterActionPerformed(e);
                }
            });
            panel12.add(btnSearchFilter, cc.xy(3, 1));
        }
        panel2.add(panel12, cc.xy(1, 1));

        //======== panel13 ========
        {
            panel13.setLayout(new FormLayout("default:grow, 2*($lcgap, 21dlu), 2*(21dlu)", "default"));
            panel13.add(hSpacer1, cc.xy(1, 1));

            //---- btnJoinFilters ----
            btnJoinFilters.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/recycle_24.png")));
            btnJoinFilters.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnJoinFiltersActionPerformed(e);
                }
            });
            panel13.add(btnJoinFilters, cc.xy(3, 1));

            //---- btnCreateFilter ----
            btnCreateFilter
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
            btnCreateFilter.setToolTipText(
                    "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnCreateFilter.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnCreateFilterActionPerformed(e);
                }
            });
            panel13.add(btnCreateFilter, cc.xy(5, 1));

            //---- btnEditFilter ----
            btnEditFilter
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
            btnEditFilter.setToolTipText(
                    "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnEditFilter.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnEditFilterActionPerformed(e);
                }
            });
            panel13.add(btnEditFilter, cc.xy(6, 1));

            //---- btnRemoveFilter ----
            btnRemoveFilter.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
            btnRemoveFilter.setToolTipText(
                    "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnRemoveFilter.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnRemoveFilterActionPerformed(e);
                }
            });
            panel13.add(btnRemoveFilter, cc.xy(7, 1));
        }
        panel2.add(panel13, cc.xy(5, 1));

        //======== srcTblFilters ========
        {

            //---- tblFilters ----
            tblFilters.setDoubleBuffered(true);
            tblFilters.setAutoCreateRowSorter(true);
            tblFilters.setToolTipText(
                    "\u0424\u0438\u043b\u044c\u0442\u0440\u044b, \u043f\u043e\u0434\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u043f\u043e\u0434 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430");
            tblFilters.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tblFiltersKeyPressed(e);
                }
            });
            tblFilters.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    tblFiltersMouseClicked(e);
                }
            });
            srcTblFilters.setViewportView(tblFilters);
        }
        panel2.add(srcTblFilters, cc.xywh(1, 2, 5, 1));

        //======== panel15 ========
        {
            panel15.setLayout(new FormLayout(
                    "default, default:grow, $lcgap, default, default:grow, $rgap, $lcgap, default, $rgap, default, $lcgap",
                    "2*(default)"));

            //---- label6 ----
            label6.setText("\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c");
            panel15.add(label6, cc.xy(1, 1));

            //---- cbManufactors ----
            cbManufactors.setToolTipText(
                    "\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f");
            cbManufactors.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    cbManufactorsActionPerformed(e);
                }
            });
            cbManufactors.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    cbManufactorsKeyPressed(e);
                }
            });
            panel15.add(cbManufactors, cc.xy(2, 1));

            //---- label7 ----
            label7.setText("\u0421\u0435\u0440\u0438\u044f");
            panel15.add(label7, cc.xy(4, 1));

            //---- cbSeria ----
            cbSeria.setToolTipText(
                    "\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0441\u0435\u0440\u0438\u044e");
            cbSeria.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    cbSeriaActionPerformed(e);
                }
            });
            cbSeria.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    cbSeriaKeyPressed(e);
                }
            });
            panel15.add(cbSeria, cc.xywh(5, 1, 2, 1));

            //---- btnClearSearchModel ----
            btnClearSearchModel.setText("\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c");
            btnClearSearchModel.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnClearSearchModelActionPerformed();
                }
            });
            panel15.add(btnClearSearchModel, cc.xy(8, 1));

            //---- btnSearchMotors ----
            btnSearchMotors.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/find_next_24.png")));
            btnSearchMotors.setToolTipText(
                    "\u041f\u043e\u0438\u0441\u043a \u043c\u043e\u0442\u043e\u0440\u043e\u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438\u0437 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438");
            btnSearchMotors.setText("\u041f\u043e\u0438\u0441\u043a");
            btnSearchMotors.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnSearchMotorsActionPerformed(e);
                }
            });
            panel15.add(btnSearchMotors, cc.xy(10, 1));

            //======== panel1 ========
            {
                panel1.setLayout(new FormLayout(
                        "default, $lcgap, default:grow, $lcgap, default, $lcgap, default:grow, $lcgap, default, $lcgap, default:grow, $lcgap, default, $lcgap, default:grow, $lcgap, default, $lcgap, default:grow",
                        "default"));

                //---- label1 ----
                label1.setText("\u0421\u0435\u0440\u0438\u044f");
                panel1.add(label1, cc.xy(1, 1));

                //---- tbSeria ----
                tbSeria.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        tbSeriaKeyPressed(e);
                    }

                    @Override
                    public void keyTyped(KeyEvent e) {
                        tbSeriaKeyPressed(e);
                    }
                });
                panel1.add(tbSeria, cc.xy(3, 1));

                //---- label2 ----
                label2.setText("\u041c\u043e\u0434\u0435\u043b\u044c");
                panel1.add(label2, cc.xy(5, 1));

                //---- tbModel ----
                tbModel.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        tbModelKeyPressed(e);
                    }

                    @Override
                    public void keyTyped(KeyEvent e) {
                        tbModelKeyPressed(e);
                    }
                });
                panel1.add(tbModel, cc.xy(7, 1));

                //---- label3 ----
                label3.setText("\u0414\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c");
                panel1.add(label3, cc.xy(9, 1));

                //---- tbEngine ----
                tbEngine.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        tbEngineKeyPressed(e);
                    }

                    @Override
                    public void keyTyped(KeyEvent e) {
                        tbEngineKeyPressed(e);
                    }
                });
                panel1.add(tbEngine, cc.xy(11, 1));

                //---- label4 ----
                label4.setText("\u0414\u0430\u0442\u0430 \"\u0421\"");
                panel1.add(label4, cc.xy(13, 1));

                //---- tbDateF ----
                tbDateF.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        tbDateFKeyPressed(e);
                    }

                    @Override
                    public void keyTyped(KeyEvent e) {
                        tbDateFKeyPressed(e);
                    }
                });
                panel1.add(tbDateF, cc.xy(15, 1));

                //---- label9 ----
                label9.setText("\u0414\u0430\u0442\u0430 \"\u041f\u041e\"");
                panel1.add(label9, cc.xy(17, 1));

                //---- tbDateT ----
                tbDateT.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        tbDateTKeyPressed(e);
                    }

                    @Override
                    public void keyTyped(KeyEvent e) {
                        tbDateTKeyPressed(e);
                    }
                });
                panel1.add(tbDateT, cc.xy(19, 1));
            }
            panel15.add(panel1, cc.xywh(1, 2, 10, 1));
        }
        panel2.add(panel15, cc.xywh(1, 4, 5, 1));

        //======== scrollPane11 ========
        {

            //---- tblMotors ----
            tblMotors.setToolTipText(
                    "\u041c\u043e\u0442\u043e\u0440\u044b, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0443");
            tblMotors.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tblMotorsKeyPressed(e);
                }
            });
            tblMotors.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    tblMotorsMouseClicked(e);
                }
            });
            scrollPane11.setViewportView(tblMotors);
        }
        panel2.add(scrollPane11, cc.xy(1, 5));

        //======== panel18 ========
        {
            panel18.setLayout(new FormLayout("21dlu", "2*(default, $lgap), fill:default:grow"));

            //---- btnAttachMotor ----
            btnAttachMotor.setIcon(new ImageIcon(
                    getClass().getResource("/ru/goodfil/catalog/ui/icons/arrow_left_green_24.png")));
            btnAttachMotor.setToolTipText(
                    "\u041f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0442\u043e\u0440 \u043a \u0444\u0438\u043b\u044c\u0442\u0440\u0443");
            btnAttachMotor.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnAttachMotorActionPerformed(e);
                }
            });
            panel18.add(btnAttachMotor, cc.xy(1, 1));

            //---- btnDetachMotor ----
            btnDetachMotor.setIcon(new ImageIcon(
                    getClass().getResource("/ru/goodfil/catalog/ui/icons/arrow_right_green_24.png")));
            btnDetachMotor.setToolTipText(
                    "\u041e\u0442\u0432\u044f\u0437\u0430\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0442\u043e\u0440 \u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u0430");
            btnDetachMotor.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnDetachMotorActionPerformed(e);
                }
            });
            panel18.add(btnDetachMotor, cc.xy(1, 3));
            panel18.add(vSpacer2, cc.xy(1, 5));
        }
        panel2.add(panel18, cc.xy(3, 5));

        //======== scrollPane12 ========
        {

            //---- tblAllMotors ----
            tblAllMotors.setToolTipText(
                    "\u041c\u043e\u0442\u043e\u0440\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438");
            tblAllMotors.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tblAllMotorsKeyPressed(e);
                }
            });
            tblAllMotors.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    tblAllMotorsMouseClicked(e);
                }
            });
            scrollPane12.setViewportView(tblAllMotors);
        }
        panel2.add(scrollPane12, cc.xy(5, 5));

        //======== panel16 ========
        {
            panel16.setLayout(new FormLayout("default:grow", "default"));
            panel16.add(hSpacer3, cc.xy(1, 1));
        }
        panel2.add(panel16, cc.xy(1, 7));

        //======== panel17 ========
        {
            panel17.setLayout(new FormLayout("default, default:grow, 21dlu", "default"));

            //---- label8 ----
            label8.setText("\u041d\u043e\u043c\u0435\u0440 \u041e\u0415");
            panel17.add(label8, cc.xy(1, 1));

            //---- tbOe ----
            tbOe.setToolTipText(
                    "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u041e\u0415 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430");
            tbOe.addKeyListener(new KeyAdapter() {
                @Override
                public void keyReleased(KeyEvent e) {
                    tbOeKeyTyped(e);
                }

                @Override
                public void keyTyped(KeyEvent e) {
                    tbOeKeyTyped(e);
                }
            });
            tbOe.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    tbOeFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    tbOeFocusGained(e);
                }
            });
            panel17.add(tbOe, cc.xy(2, 1));

            //---- btnOeSearch ----
            btnOeSearch.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/find_next_24.png")));
            btnOeSearch.setToolTipText("\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u041e\u0415");
            btnOeSearch.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnOeSearchActionPerformed(e);
                }
            });
            panel17.add(btnOeSearch, cc.xy(3, 1));
        }
        panel2.add(panel17, cc.xy(5, 7));

        //======== scrollPane7 ========
        {

            //---- tblOes ----
            tblOes.setSurrendersFocusOnKeystroke(true);
            tblOes.setToolTipText(
                    "\u041e\u0415, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043a \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0443");
            tblOes.setAutoCreateRowSorter(true);
            tblOes.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tblOesKeyPressed(e);
                }
            });
            tblOes.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    tblOesMouseClicked(e);
                }
            });
            scrollPane7.setViewportView(tblOes);
        }
        panel2.add(scrollPane7, cc.xy(1, 8));

        //======== panel19 ========
        {
            panel19.setLayout(
                    new FormLayout("21dlu", "fill:default, $lgap, default, $lgap, fill:default:grow"));

            //---- btnAttachOe ----
            btnAttachOe.setIcon(new ImageIcon(
                    getClass().getResource("/ru/goodfil/catalog/ui/icons/arrow_left_green_24.png")));
            btnAttachOe.setToolTipText(
                    "\u041f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u041e\u0415 \u043a \u0444\u0438\u043b\u044c\u0442\u0440\u0443");
            btnAttachOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnAttachOeActionPerformed(e);
                }
            });
            panel19.add(btnAttachOe, cc.xy(1, 1));

            //---- btnDetachOe ----
            btnDetachOe.setIcon(new ImageIcon(
                    getClass().getResource("/ru/goodfil/catalog/ui/icons/arrow_right_green_24.png")));
            btnDetachOe.setToolTipText(
                    "\u041e\u0442\u0432\u044f\u0437\u0430\u0442\u044c \u041e\u0415 \u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u0430");
            btnDetachOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnDetachOeActionPerformed(e);
                }
            });
            panel19.add(btnDetachOe, cc.xy(1, 3));
            panel19.add(vSpacer3, cc.xy(1, 5));
        }
        panel2.add(panel19, cc.xy(3, 8));

        //======== scrollPane8 ========
        {

            //---- tblAllOes ----
            tblAllOes.setToolTipText(
                    "\u041f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u041e\u0415, \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0434 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u0430");
            tblAllOes.setAutoCreateRowSorter(true);
            tblAllOes.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tblAllOesKeyPressed(e);
                }
            });
            tblAllOes.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    tblAllOesMouseClicked(e);
                }
            });
            scrollPane8.setViewportView(tblAllOes);
        }
        panel2.add(scrollPane8, cc.xy(5, 8));
    }
    add(panel2, cc.xy(1, 1));

    //======== tablesPopupMenu ========
    {
        tablesPopupMenu.addPopupMenuListener(new PopupMenuListener() {
            @Override
            public void popupMenuCanceled(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                tablesPopupMenuPopupMenuWillBecomeVisible(e);
            }
        });

        //---- miFullCopyToExcel ----
        miFullCopyToExcel.setText(
                "\u041f\u043e\u043b\u043d\u0430\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437\u0434\u0435\u043b\u0438\u044f \u0432 Excel");
        miFullCopyToExcel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                miFullCopyToExcelActionPerformed(e);
            }
        });
        tablesPopupMenu.add(miFullCopyToExcel);

        //======== menu1 ========
        {
            menu1.setText("\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Excel");

            //---- miCopySelectedToExcel ----
            miCopySelectedToExcel.setText(
                    "\u0422\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438");
            miCopySelectedToExcel.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miCopySelectedToExcelActionPerformed(e);
                }
            });
            menu1.add(miCopySelectedToExcel);

            //---- miCopyToExcel ----
            miCopyToExcel.setText("\u0412\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438");
            miCopyToExcel.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miCopyToExcelActionPerformed(e);
                }
            });
            menu1.add(miCopyToExcel);
        }
        tablesPopupMenu.add(menu1);
        tablesPopupMenu.addSeparator();

        //======== menu2 ========
        {
            menu2.setText(
                    "\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0443\u0444\u0435\u0440");

            //---- miCopySelectedToBuffer ----
            miCopySelectedToBuffer.setText(
                    "\u0422\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438");
            miCopySelectedToBuffer.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miCopySelectedToBufferActionPerformed(e);
                }
            });
            menu2.add(miCopySelectedToBuffer);

            //---- miCopyToBuffer ----
            miCopyToBuffer.setText("\u0412\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438");
            miCopyToBuffer.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miCopyToBufferActionPerformed(e);
                }
            });
            menu2.add(miCopyToBuffer);
        }
        tablesPopupMenu.add(menu2);

        //---- miPasteFromBuffer ----
        miPasteFromBuffer.setText(
                "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430");
        miPasteFromBuffer.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                miPasteFromBufferActionPerformed(e);
            }
        });
        tablesPopupMenu.add(miPasteFromBuffer);
        tablesPopupMenu.addSeparator();

        //======== miShowOnSiteMenu ========
        {
            miShowOnSiteMenu.setText(
                    "\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435?");

            //---- miShowOnSite ----
            miShowOnSite.setText("\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c");
            miShowOnSite.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miShowOnSiteActionPerformed(e);
                }
            });
            miShowOnSiteMenu.add(miShowOnSite);

            //---- miDontShowOnSite ----
            miDontShowOnSite
                    .setText("\u041d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c");
            miDontShowOnSite.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miDontShowOnSiteActionPerformed(e);
                }
            });
            miShowOnSiteMenu.add(miDontShowOnSite);
        }
        tablesPopupMenu.add(miShowOnSiteMenu);

        //======== miApplyToAllMenu ========
        {
            miApplyToAllMenu.setText(
                    "\u0413\u043b\u043e\u0431\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430?");

            //---- miApplyToVT1 ----
            miApplyToVT1.setText(
                    "\u041a \u043b\u0435\u0433\u043a\u043e\u0432\u044b\u043c \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f\u043c");
            miApplyToVT1.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miApplyToVT1ActionPerformed(e);
                }
            });
            miApplyToAllMenu.add(miApplyToVT1);

            //---- miApplyToVT2 ----
            miApplyToVT2.setText(
                    "\u041a \u0433\u0440\u0443\u0437\u043e\u0432\u044b\u043c \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f\u043c");
            miApplyToVT2.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miApplyToVT2ActionPerformed(e);
                }
            });
            miApplyToAllMenu.add(miApplyToVT2);

            //---- miApplyToVT3 ----
            miApplyToVT3.setText(
                    "\u041a \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u0438\u043a\u0435");
            miApplyToVT3.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miApplyToVT3ActionPerformed(e);
                }
            });
            miApplyToAllMenu.add(miApplyToVT3);

            //---- miApplyToVT4 ----
            miApplyToVT4.setText(
                    "\u041a \u043a\u0430\u0442\u0435\u0440\u0430\u043c \u0438 \u043c\u043e\u0442\u043e\u0446\u0438\u043a\u043b\u0430\u043c");
            miApplyToVT4.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miApplyToVT4ActionPerformed(e);
                }
            });
            miApplyToAllMenu.add(miApplyToVT4);

            //---- miDontApplyToAll ----
            miDontApplyToAll.setText(
                    "\u0423\u0431\u0440\u0430\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443");
            miDontApplyToAll.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    miDontApplyToAllActionPerformed(e);
                }
            });
            miApplyToAllMenu.add(miDontApplyToAll);
        }
        tablesPopupMenu.add(miApplyToAllMenu);
    }
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:ru.goodfil.catalog.ui.forms.OePanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - ????? ???????
    panel1 = new JPanel();
    panel2 = new JPanel();
    btnCreateBrand = new JButton();
    btnEditBrand = new JButton();
    btnRemoveBrand = new JButton();
    btnUnionBrand = new JButton();
    hSpacer1 = new JPanel(null);
    tbSearchBrand = new JTextField();
    btnSearchBrand = new JButton();
    scrollPane1 = new JScrollPane();
    lstBrands = new JList();
    lLstBrandsStatus = new JLabel();
    panel3 = new JPanel();
    panel4 = new JPanel();
    btnCreateOe = new JButton();
    btnEditOe = new JButton();
    btnRemoveOe = new JButton();
    btnUnionOe = new JButton();
    hSpacer2 = new JPanel(null);
    tbSearchOe = new JTextField();
    btnSearchOe = new JButton();
    scrollPane2 = new JScrollPane();
    lstOes = new JList();
    lLstOesStatus = new JLabel();
    popupMenu1 = new JPopupMenu();
    menuItem1 = new JMenuItem();
    menuItem2 = new JMenuItem();
    menuItem3 = new JMenuItem();
    menuItem4 = new JMenuItem();
    popupMenu2 = new JPopupMenu();
    menu1 = new JMenu();
    menuItem5 = new JMenuItem();
    menuItem6 = new JMenuItem();
    CellConstraints cc = new CellConstraints();

    //======== this ========

    // JFormDesigner evaluation mark
    setBorder(//from  w w w .j ava 2 s . com
            new javax.swing.border.CompoundBorder(
                    new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                            "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                            javax.swing.border.TitledBorder.BOTTOM,
                            new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                    getBorder()));
    addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent e) {
            if ("border".equals(e.getPropertyName()))
                throw new RuntimeException();
        }
    });

    setLayout(new FormLayout("default:grow, $lcgap, default:grow", "fill:default:grow"));

    //======== panel1 ========
    {
        panel1.setBorder(new TitledBorder(
                "\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0438"));
        panel1.setLayout(
                new FormLayout("default:grow", "fill:21dlu, $lgap, fill:default:grow, $lgap, default"));

        //======== panel2 ========
        {
            panel2.setLayout(new FormLayout("4*(21dlu), default:grow, 100dlu, 21dlu", "fill:default:grow"));

            //---- btnCreateBrand ----
            btnCreateBrand
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
            btnCreateBrand.setToolTipText(
                    "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnCreateBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnCreateBrandActionPerformed(e);
                }
            });
            panel2.add(btnCreateBrand, cc.xy(1, 1));

            //---- btnEditBrand ----
            btnEditBrand
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
            btnEditBrand.setToolTipText(
                    "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnEditBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnEditBrandActionPerformed(e);
                }
            });
            panel2.add(btnEditBrand, cc.xy(2, 1));

            //---- btnRemoveBrand ----
            btnRemoveBrand.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
            btnRemoveBrand.setToolTipText(
                    "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnRemoveBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnRemoveBrandActionPerformed(e);
                }
            });
            panel2.add(btnRemoveBrand, cc.xy(3, 1));

            //---- btnUnionBrand ----
            btnUnionBrand.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/recycle_24.png")));
            btnUnionBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnUnionBrandActionPerformed(e);
                }
            });
            panel2.add(btnUnionBrand, cc.xy(4, 1));
            panel2.add(hSpacer1, cc.xy(5, 1));

            //---- tbSearchBrand ----
            tbSearchBrand.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tbSearchBrandKeyTyped(e);
                }

                @Override
                public void keyReleased(KeyEvent e) {
                    tbSearchBrandKeyTyped(e);
                }

                @Override
                public void keyTyped(KeyEvent e) {
                    tbSearchBrandKeyTyped(e);
                }
            });
            tbSearchBrand.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    tbSearchBrandFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    tbSearchBrandFocusGained(e);
                }
            });
            panel2.add(tbSearchBrand, cc.xy(6, 1));

            //---- btnSearchBrand ----
            btnSearchBrand.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/find_next_24.png")));
            btnSearchBrand.setToolTipText(
                    "\u041f\u043e\u0438\u0441\u043a \u043c\u043e\u0442\u043e\u0440\u043e\u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438\u0437 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438");
            btnSearchBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnSearchBrandActionPerformed(e);
                }
            });
            panel2.add(btnSearchBrand, cc.xy(7, 1));
        }
        panel1.add(panel2, cc.xy(1, 1));

        //======== scrollPane1 ========
        {

            //---- lstBrands ----
            lstBrands.setToolTipText(
                    "\u0415\u0441\u043b\u0438 \u0448\u0440\u0438\u0444\u0442 \u0411\u0440\u0435\u043d\u0434\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d \u043f\u043e\u043b\u0443\u0436\u0438\u0440\u043d\u044b\u043c, \u0442\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0435\u043d \u0432 \u043e\u0442\u0447\u0443\u0436\u0434\u0430\u0435\u043c\u043e\u0439 \u043a\u043e\u043f\u0438\u0438, \u0434\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043e\u043a. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043d\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d, \u0442\u043e \u0432\u0438\u0434\u0435\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.");
            lstBrands.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    lstBrandsValueChanged(e);
                }
            });
            lstBrands.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    lstBrandsKeyPressed(e);
                }
            });
            lstBrands.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    lstBrandsMouseClicked(e);
                }
            });
            scrollPane1.setViewportView(lstBrands);
        }
        panel1.add(scrollPane1, cc.xy(1, 3));

        //---- lLstBrandsStatus ----
        lLstBrandsStatus.setText("text");
        panel1.add(lLstBrandsStatus, cc.xy(1, 5));
    }
    add(panel1, cc.xy(1, 1));

    //======== panel3 ========
    {
        panel3.setBorder(new TitledBorder("\u041d\u043e\u043c\u0435\u0440\u0430 \u041e\u0415"));
        panel3.setLayout(new FormLayout("default:grow", "default, $lgap, fill:default:grow, $lgap, default"));

        //======== panel4 ========
        {
            panel4.setLayout(new FormLayout("4*(21dlu), default:grow, 100dlu, 21dlu", "fill:21dlu"));

            //---- btnCreateOe ----
            btnCreateOe
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
            btnCreateOe.setToolTipText(
                    "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnCreateOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnCreateOeActionPerformed(e);
                }
            });
            panel4.add(btnCreateOe, cc.xy(1, 1));

            //---- btnEditOe ----
            btnEditOe
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
            btnEditOe.setToolTipText(
                    "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnEditOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnEditOeActionPerformed(e);
                }
            });
            panel4.add(btnEditOe, cc.xy(2, 1));

            //---- btnRemoveOe ----
            btnRemoveOe.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
            btnRemoveOe.setToolTipText(
                    "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnRemoveOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnRemoveOeActionPerformed(e);
                }
            });
            panel4.add(btnRemoveOe, cc.xy(3, 1));

            //---- btnUnionOe ----
            btnUnionOe.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/recycle_24.png")));
            btnUnionOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnUnionOeActionPerformed(e);
                }
            });
            panel4.add(btnUnionOe, cc.xy(4, 1));
            panel4.add(hSpacer2, cc.xy(5, 1));

            //---- tbSearchOe ----
            tbSearchOe.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tbSearchOeKeyPressed(e);
                }

                @Override
                public void keyReleased(KeyEvent e) {
                    tbSearchOeKeyPressed(e);
                }
            });
            tbSearchOe.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    tbSearchOeFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    tbSearchOeFocusGained(e);
                }
            });
            panel4.add(tbSearchOe, cc.xy(6, 1));

            //---- btnSearchOe ----
            btnSearchOe.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/find_next_24.png")));
            btnSearchOe.setToolTipText(
                    "\u041f\u043e\u0438\u0441\u043a \u043c\u043e\u0442\u043e\u0440\u043e\u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438\u0437 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438");
            btnSearchOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnSearchOeActionPerformed(e);
                }
            });
            panel4.add(btnSearchOe, cc.xy(7, 1));
        }
        panel3.add(panel4, cc.xy(1, 1));

        //======== scrollPane2 ========
        {

            //---- lstOes ----
            lstOes.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    lstOesKeyPressed(e);
                }
            });
            lstOes.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    lstOesValueChanged(e);
                }
            });
            lstOes.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    lstOesMouseClicked(e);
                }
            });
            scrollPane2.setViewportView(lstOes);
        }
        panel3.add(scrollPane2, cc.xy(1, 3));

        //---- lLstOesStatus ----
        lLstOesStatus.setText("text");
        panel3.add(lLstOesStatus, cc.xy(1, 5));
    }
    add(panel3, cc.xy(3, 1));

    //======== popupMenu1 ========
    {
        popupMenu1.addPopupMenuListener(new PopupMenuListener() {
            @Override
            public void popupMenuCanceled(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                popupMenu1PopupMenuWillBecomeVisible(e);
            }
        });

        //---- menuItem1 ----
        menuItem1.setText(
                "\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0443\u0444\u0435\u0440");
        menuItem1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                copyToClipboard(e);
            }
        });
        popupMenu1.add(menuItem1);

        //---- menuItem2 ----
        menuItem2.setText(
                "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430");
        menuItem2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                pasteFromClipboard(e);
            }
        });
        popupMenu1.add(menuItem2);
        popupMenu1.addSeparator();

        //---- menuItem3 ----
        menuItem3.setText(
                "\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0431\u0443\u0444\u0435\u0440 (\u0421 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c)");
        menuItem3.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                cutToClipboard(e);
            }
        });
        popupMenu1.add(menuItem3);

        //---- menuItem4 ----
        menuItem4.setText(
                "\u0412\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430");
        menuItem4.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                pasteFromClipboard(e);
            }
        });
        popupMenu1.add(menuItem4);
    }

    //======== popupMenu2 ========
    {

        //======== menu1 ========
        {
            menu1.setText(
                    "\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043e\u0442\u0447\u0443\u0436\u0434\u0430\u0435\u043c\u043e\u0439 \u043a\u043e\u043f\u0438\u0438");

            //---- menuItem5 ----
            menuItem5.setText("\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c");
            menuItem5.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItemReprezentInStandalone(e);
                }
            });
            menu1.add(menuItem5);

            //---- menuItem6 ----
            menuItem6.setText("\u041d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c");
            menuItem6.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItemDontReprezentInStandalone(e);
                }
            });
            menu1.add(menuItem6);
        }
        popupMenu2.add(menu1);
    }
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:statechum.analysis.learning.Visualiser.java

public void construct(Graph g, LayoutOptions options) {
    if (!globalConfig.isAssertEnabled()
            && Boolean.getBoolean(globalConfig.getProperty(G_PROPERTIES.ASSERT_ENABLED))) {
        System.err.println("Pass the -ea argument to JVM to enable assertions");
    }/*from   www.  ja  v  a  2 s .co m*/

    //
    if (Boolean.valueOf(GlobalConfiguration.getConfiguration()
            .getProperty(GlobalConfiguration.G_PROPERTIES.CLOSE_TERMINATE)))
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    else if (Boolean.valueOf(
            GlobalConfiguration.getConfiguration().getProperty(GlobalConfiguration.G_PROPERTIES.ESC_TERMINATE)))
        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    else
        this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);

    this.addWindowListener(new WindowEventHandler());
    /*
    this.addComponentListener(new ComponentListener() {
             
     @Override
     public void componentShown(@SuppressWarnings("unused") ComponentEvent e) {}
             
     @Override
     public void componentResized(@SuppressWarnings("unused") ComponentEvent e) {
    if (viewer != null) viewer.getModel().getGraphLayout().resize(getSize());
     }
             
     @Override
     public void componentMoved(@SuppressWarnings("unused") ComponentEvent e) {}
             
     @Override
     public void componentHidden(@SuppressWarnings("unused") ComponentEvent e) {}
    });*/
    this.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent arg0) {
            Action act = keyToActionMap.get(arg0.getKeyCode());
            if (act != null) {
                act.actionPerformed(null);
            }
        }

        @Override
        public void keyReleased(@SuppressWarnings("unused") KeyEvent arg0) {// this method is intentionally left blank - keypresses/releases are handled by the keyPressed method.
        }

        @Override
        public void keyTyped(@SuppressWarnings("unused") KeyEvent key) {// this method is intentionally left blank - keypresses/releases are handled by the keyPressed method.
        }
    });

    popupMenu = new JPopupMenu();
    // Icon loading is from http://www.javaworld.com/javaworld/javaqa/2000-06/03-qa-0616-icon.html
    Image icon = Toolkit.getDefaultToolkit()
            .getImage(GlobalConfiguration.getConfiguration().getProperty(G_PROPERTIES.RESOURCES)
                    + File.separator + "icon.jpg");
    if (icon != null) {
        setIconImage(icon);
    }

    setVisualiserKeyBindings();
    setStateChumKeyBindings(this, propName, keyToActionMap);
    updatePopupMenu(popupMenu, keyToActionMap);
    //getContentPane().removeAll();
    WindowPosition framePosition = globalConfig.loadFrame(propName);

    viewer = new VisualizationViewer(
            new DefaultVisualizationModel(
                    new XMLPersistingLayout(propName >= 0 ? new FRLayout(g) : new KKLayout(g))),
            constructRenderer(g, options));

    viewer.setBackground(Color.WHITE);
    final DefaultModalGraphMouse graphMouse = new XMLModalGraphMouse();
    graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
    graphMouse.add(new PickingGraphMousePlugin());
    viewer.setGraphMouse(graphMouse);
    viewer.setPickSupport(new ShapePickSupport());
    viewer.addMouseListener(this);

    final GraphZoomScrollPane panel = new GraphZoomScrollPane(viewer);
    getContentPane().add(panel);
    pack();
    viewer.setPreferredSize(getSize());
    //viewer.getModel().getGraphLayout().initialize(getSize());

    restoreLayout(true, currentGraph);
    setBounds(framePosition.getRect());
    framesVisible.add(this);// register as an active frame.
    setVisible(true);
}

From source file:statechum.analysis.learning.Visualiser.java

private void maybeShowPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {
        if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0)
            popupMenu.show(e.getComponent(), e.getX(), e.getY());
        else/*from  w  w  w .  j  a v  a  2s  .  co  m*/
        // attempt the popup for the diff
        if (currentGraph >= 0) {// if there are any graphs in this frame
            JPopupMenu diffMenu = new JPopupMenu();
            final LearnerGraphND ourGraph = graphsOrig.get(currentGraph);
            if (ourGraph != null) {// if this is a real graph
                for (Visualiser viz : framesVisible) {
                    final Visualiser fViz = viz;
                    if (fViz.currentGraph >= 0) {
                        final LearnerGraphND otherGr = fViz.graphsOrig.get(fViz.currentGraph);
                        if (ourGraph != otherGr && otherGr != null) {// only if this is a real graph
                            JMenuItem menuitem = new JMenuItem(new AbstractAction() {
                                /**
                                 * ID for serialization
                                 */
                                private static final long serialVersionUID = 6840129509410881970L;

                                {// Constructor
                                    putValue(Action.NAME, otherGr.getNameNotNull());
                                    putValue(SHORT_DESCRIPTION, otherGr.getNameNotNull());
                                }

                                @Override
                                public void actionPerformed(@SuppressWarnings("unused") ActionEvent ev) {
                                    GD<List<CmpVertex>, List<CmpVertex>, LearnerGraphNDCachedData, LearnerGraphNDCachedData> gd = new GD<List<CmpVertex>, List<CmpVertex>, LearnerGraphNDCachedData, LearnerGraphNDCachedData>();
                                    DirectedSparseGraph gr =
                                            //gd.showGD(ourGraph,otherGr,ExperimentRunner.getCpuNumber());
                                            ChangesToGraph.computeVisualisationParameters(
                                                    Synapse.StatechumProcess.constructFSM(ourGraph),
                                                    ChangesToGraph.computeGD(ourGraph, otherGr,
                                                            ourGraph.config));

                                    Visualiser.updateFrame(gr, null);
                                }

                            });
                            diffMenu.add(menuitem);
                        }
                    } // if otherGr != null
                } // if fViz.graphs.size() > 0

                if (diffMenu.getComponentCount() > 0)
                    diffMenu.show(e.getComponent(), e.getX(), e.getY());

            } // if ourGraph != null
        } // if graphs.size() > 0
    } // e.isPopupTrigger()

}

From source file:storybook.model.EntityUtil.java

public static JPopupMenu createPopupMenu(MainFrame mainFrame, AbstractEntity entity) {
    JPopupMenu menu = new JPopupMenu();
    if (entity == null) {
        return null;
    }/*from  w w w  .j a v a2 s. com*/
    if (entity.isTransient()) {
        return null;
    }
    JLabel lbTitle = new JLabel("   " + entity.toString());
    lbTitle.setFont(FontUtil.getBoldFont());
    menu.add(lbTitle);
    menu.add(new JPopupMenu.Separator());
    menu.add(new EditEntityAction(mainFrame, entity, false));
    if (entity instanceof Scene) {
        if (BookUtil.isUseLibreOffice(mainFrame)) {
            menu.add(new EditSceneLOAction(mainFrame, entity));
        }
    }
    menu.add(new DeleteEntityAction(mainFrame, entity));
    menu.add(new JPopupMenu.Separator());
    if (entity instanceof Scene || entity instanceof Chapter) {
        menu.add(new ShowInChronoViewAction(mainFrame, entity));
        menu.add(new ShowInBookViewAction(mainFrame, entity));
        menu.add(new ShowInManageViewAction(mainFrame, entity));
    }
    menu.add(new ShowInfoAction(mainFrame, entity));
    if (isAvailableInMemoria(entity)) {
        menu.add(new ShowInMemoriaAction(mainFrame, entity));
    }
    menu.add(new JPopupMenu.Separator());
    if (entity instanceof Scene) {
    }
    if (entity instanceof Chapter) {
        menu.add(new ChapterOrderByTimestampAction(mainFrame, (Chapter) entity));
        menu.add(new ChapterReSortAction(mainFrame, (Chapter) entity));
        menu.add(new JPopupMenu.Separator());
    }
    menu.add(new NewEntityAction(mainFrame, entity));
    if (entity instanceof Location) {
        // google maps
        menu.add(new JPopupMenu.Separator());
        menu.add(new ShowInGoogleMapsAction((Location) entity));
    }
    if (menu.getComponents().length == 0) {
        return null;
    }
    return menu;
}

From source file:streamme.visuals.Main.java

/**
 * Creates new form Main// w w w.j  a  v  a  2 s .co  m
 */
public Main() {
    player = Player.getInstance();
    player.setListener(this);

    setIconImage(
            Toolkit.getDefaultToolkit().getImage(getClass().getClassLoader().getResource("res/icon32.png")));
    loadTray();

    hotkeyProvider = Provider.getCurrentProvider(false);
    hotkeyProvider.register(KeyStroke.getKeyStroke("alt UP"), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            btn_playPauseActionPerformed(null);
        }
    });
    hotkeyProvider.register(KeyStroke.getKeyStroke("alt RIGHT"), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            btn_nextActionPerformed(null);
        }
    });
    hotkeyProvider.register(KeyStroke.getKeyStroke("alt LEFT"), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            btn_prevActionPerformed(null);
        }
    });
    hotkeyProvider.register(KeyStroke.getKeyStroke("alt DOWN"), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            btn_stopActionPerformed(null);
        }
    });

    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Windows".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }

    initComponents();
    //getContentPane().setBackground(new java.awt.Color(123,161,214));
    PlaylistManager.get().setFrame(this);

    this.setLocationRelativeTo(null);

    treeMenu = new JPopupMenu();

    JMenuItem itemOpenToNew = new JMenuItem("Open to a new playlist");
    itemOpenToNew.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree_files.getLastSelectedPathComponent();
            if (node == null)
                return;
            DataNode dn = (DataNode) node.getUserObject();
            int idx = PlaylistManager.get().addPlaylist(dn.getName());
            addToPlaylist(node, idx, true);
        }
    });

    JMenuItem itemAdd = new JMenuItem("Add to selected playlist...");
    itemAdd.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree_files.getLastSelectedPathComponent();
            if (node == null)
                return;
            addToPlaylist(node, playlistsPanel.getSelectedIndex(), true);
        }
    });

    treeMenu.add(itemOpenToNew);
    treeMenu.add(itemAdd);
    //tree_files.setComponentPopupMenu(menu);

    renamePlaylistKeyListener = new KeyListener() {
        @Override
        public void keyTyped(KeyEvent e) {
        }

        @Override
        public void keyPressed(KeyEvent e) {
        }

        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == 113) { // F2
                int idx = playlistsPanel.getSelectedIndex();
                if (idx < 0)
                    return;
                String oldTitle = playlistsPanel.getTitleAt(idx);
                String s = (String) JOptionPane.showInputDialog(Main.this, "Rename playlist:",
                        "Rename playlist", JOptionPane.PLAIN_MESSAGE, null, null, oldTitle);
                if (s != null) {
                    PlaylistManager.get().renameTab(idx, s);
                }
            }
        }
    };

    playlistsPanel.addKeyListener(renamePlaylistKeyListener);
}

From source file:studio.ui.Studio.java

private void rebuildMenus(TabIndexChanged event) {
    AppMenuBar appMenubar = getJMenuBar() instanceof AppMenuBar ? (AppMenuBar) getJMenuBar() : null;
    ToolBarActions toolBar = null;/*w  w w  . java 2 s  .  c  om*/
    ActionMenu menuBar = null;
    if (appToolbar == null && appMenubar == null) {
        appToolbar = new ToolBarActions();
        getContentPane().add(appToolbar, BorderLayout.NORTH);
        appMenubar = new AppMenuBar();
        setJMenuBar(appMenubar);
        toolBar = new ToolBarActions("File");
        menuBar = new ActionMenu("File", 'f', "File operations", (MouseAdapter) null);
        Action action = new NewFileAction(tabEditors, tabConsoles);

        JPopupMenu popupMenu = new JPopupMenu();

        JMenuItem item = new JMenuItem("Script");
        item.setToolTipText("New script");
        item.addMouseListener(new ActionHintsListener(tabEditors, "Create new script"));
        item.addActionListener(action);
        popupMenu.add(item);

        item = new JMenuItem("Project");
        item.setToolTipText("New project");
        item.addMouseListener(new ActionHintsListener(tabEditors, "Create new project"));
        try {
            item.addActionListener(new AddProjectAction(treeProjects));
            popupMenu.add(item);
        } catch (StudioException ex) {
        }

        JButton button = new DropDownButton(action, popupMenu);
        if (button instanceof DataListener) {
            tabEditors.addFireDataListener((DataListener) button);
        }
        button.addMouseListener(new ActionHintsListener(tabEditors, action));
        toolBar.add(button);
        menuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));

        action = new OpenFileAction(tabEditors, tabConsoles);
        menuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        popupMenu = null;
        if (studioConfig.getOpenedFiles() != null && !studioConfig.getOpenedFiles().isEmpty()) {
            popupMenu = new JPopupMenu();
            int pos = 0;
            for (EditorFile file : studioConfig.getOpenedFiles()) {
                item = new JMenuItem((char) (pos + 48) + " " + file.getPath(), pos + 48);
                item.addMouseListener(new ActionHintsListener(tabEditors, "Open file " + file));
                popupMenu.add(item);
                if (++pos > 9) {
                    break;
                }
            }
        }
        button = new DropDownButton(action, popupMenu);
        if (button instanceof DataListener) {
            tabEditors.addFireDataListener((DataListener) button);
        }
        button.addMouseListener(new ActionHintsListener(tabEditors, action));
        toolBar.add(button);
        appToolbar.add(toolBar);
        appMenubar.add(menuBar);

        appToolbar.add(new ToolBarActions("KDB+"));
        appMenubar.add(new ActionMenu("KDB+", 'k', "KDB+ databse operations", (MouseAdapter) null));
        appToolbar.add(new ToolBarActions("Edit"));
        appMenubar.add(new ActionMenu("Edit", 'E', "Editor operations", (MouseAdapter) null));
        toolBar = new ToolBarActions("Options");
        appToolbar.add(toolBar);
        menuBar = new ActionMenu("Tools", 'T', "Tools", (MouseAdapter) null);
        ActionMenu opMenuBar = new ActionMenu("Options", 'O', "Studio settings", (MouseAdapter) null);
        ActionMenu lfMenuBar = new ActionMenu("Look and feel", 'L', "L&F", (MouseAdapter) null);
        LookAndFeelAction.getActionLookAndFeel(this, lfMenuBar, studioConfig);
        opMenuBar.add(lfMenuBar);
        opMenuBar.addSeparator();
        action = new EditorSettingsAction(this);
        opMenuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        action = new TokensSettingsAction(this);
        opMenuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        opMenuBar.addSeparator();
        action = new ConsoleSettingsAction(this);
        opMenuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        opMenuBar.addSeparator();
        action = new ConnectionsSettingsAction(treeConnections);
        opMenuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        menuBar.add(opMenuBar);
        opMenuBar.addSeparator();
        action = new GlobalSettingsAction(this);
        opMenuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        appMenubar.add(menuBar);
        opMenuBar.addSeparator();
        action = new ProjectSettingsAction(this);
        opMenuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        appMenubar.add(menuBar);
        menuBar = new ActionMenu("Help", 'H', "Help...", (MouseAdapter) null);
        action = new VisitKxAction();
        menuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        menuBar.addSeparator();
        action = new VisitWroclawAction();
        menuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        menuBar.addSeparator();
        action = new KeyListAction(tabEditors);
        menuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        menuBar.addSeparator();
        action = new AboutAction(tabEditors);
        menuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        appMenubar.add(menuBar);
        menuBar.addSeparator();
        action = new CheckUpdate(this);
        menuBar.add(new ActionMenuItem(action, new ActionHintsListener(tabEditors, action)));
        appMenubar.add(menuBar);
        toolBar = null;

        this.setJMenuBar(appMenubar);
    }

    appToolbar.getToolBar("Edit").setVisible(event != null && event.getData() != -1);
    appToolbar.getToolBar("Options").setVisible(event != null && event.getData() != -1);
    appToolbar.getToolBar("KDB+").setVisible(event != null && event.getData() != -1);
    appToolbar.getToolBar("File").setVisible(event != null && event.getData() != -1);

    appMenubar.getMenu("Edit").setVisible(event != null && event.getData() != -1);
    appMenubar.getMenu("Tools").setVisible(event != null && event.getData() != -1);
    appMenubar.getMenu("KDB+").setVisible(event != null && event.getData() != -1);
    appMenubar.getMenu("File").setVisible(event != null && event.getData() != -1);

    if (event != null && event.getSource() instanceof EditorsTabbedPane && event.getData() != -1) {
        Editor editor = ((EditorsTabbedPane) event.getSource()).getEditor(event.getData());
        if (editor != null) {
            JPopupMenu menu = editor.getComponentPopupMenu();
            if (menu != null) {
                for (int count = 0; count < menu.getComponentCount(); count++) {
                    if (menu.getComponent(count) instanceof JMenuItem) {
                        JMenuItem menuItem = (JMenuItem) menu.getComponent(count);
                        if (menuItem.getAction().getClass() == SaveAction.class) {
                            appToolbar.getToolBar("File").update(tabEditors, menuItem.getAction(), true);
                            appMenubar.getMenu("File").update(tabEditors, menuItem.getAction(), true);
                        } else {
                            if (menuItem.getAction().getClass() == SaveAsAction.class
                                    || menuItem.getAction().getClass() == SaveAllAction.class) {
                                appToolbar.getToolBar("File").update(tabEditors, menuItem.getAction());
                                appMenubar.getMenu("File").update(tabEditors, menuItem.getAction());
                            } else {
                                if (menuItem.getAction().getClass() == CloseAction.class) {
                                    appToolbar.getToolBar("File").update(tabEditors, menuItem.getAction(),
                                            true);
                                    appMenubar.getMenu("File").update(tabEditors, menuItem.getAction(), true);
                                } else {
                                    if (menuItem.getAction().getClass() == CloseAllAction.class) {
                                        appToolbar.getToolBar("File").update(tabEditors, menuItem.getAction());
                                        appMenubar.getMenu("File").update(tabEditors, menuItem.getAction());
                                    } else {
                                        if (menuItem.getAction().getClass() == RunAction.class
                                                || menuItem.getAction().getClass() == RunLineAction.class
                                                || menuItem.getAction().getClass() == CancelRunAction.class) {
                                            appToolbar.getToolBar("KDB+").update(tabEditors,
                                                    menuItem.getAction());
                                            appMenubar.getMenu("KDB+").update(tabEditors, menuItem.getAction());
                                        } else {
                                            if (menuItem.getAction().getClass() == ExtKit.ReplaceAction.class
                                                    || menuItem.getAction()
                                                            .getClass() == ActionFactory.RedoAction.class
                                                    || menuItem.getAction()
                                                            .getClass() == ActionFactory.UndoAction.class
                                                    || menuItem.getAction()
                                                            .getClass() == BaseKit.CopyAction.class
                                                    || menuItem.getAction()
                                                            .getClass() == BaseKit.PasteAction.class
                                                    || menuItem.getAction()
                                                            .getClass() == ExtKit.GotoAction.class
                                                    || menuItem.getAction()
                                                            .getClass() == BaseKit.SelectAllAction.class
                                                    || menuItem.getAction()
                                                            .getClass() == BaseKit.SelectLineAction.class
                                                    || menuItem.getAction()
                                                            .getClass() == BaseKit.CutAction.class) {
                                                appToolbar.getToolBar("Edit").update(tabEditors,
                                                        menuItem.getAction());
                                                if (menuItem.getAction().getClass() == ExtKit.GotoAction.class
                                                        || menuItem.getAction()
                                                                .getClass() == BaseKit.CopyAction.class
                                                        || menuItem.getAction()
                                                                .getClass() == BaseKit.SelectAllAction.class) {
                                                    appMenubar.getMenu("Edit").update(tabEditors,
                                                            menuItem.getAction(), true);
                                                } else {
                                                    appMenubar.getMenu("Edit").update(tabEditors,
                                                            menuItem.getAction());
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (event != null && event.getData() != -1 && event.getSource() instanceof EditorsTabbedPane
            && ((EditorsTabbedPane) event.getSource()).getEditor(event.getData()) != null) {
        ((EditorsTabbedPane) event.getSource()).getEditor(event.getData()).requestFocus();
    }
}

From source file:utybo.branchingstorytree.swing.editor.StoryNodesEditor.java

private JPopupMenu createMenu() {
    JPopupMenu createMenu = new JPopupMenu();
    createMenu.add(new AbstractAction(Lang.get("editor.panel.text"), //
            new ImageIcon(Icons.getImage("TextNode", 16))) {
        @Override//from   w w  w.  j  a v a 2 s . c o  m
        public void actionPerformed(ActionEvent e) {
            addNode(new StoryTextNodeEditor(StoryNodesEditor.this));
        }
    });
    createMenu.add(new AbstractAction(Lang.get("editor.panel.virtual"),
            new ImageIcon(Icons.getImage("VirtualNode", 16))) {

        @Override
        public void actionPerformed(ActionEvent e) {
            addNode(new StoryVirtualNodeEditor(StoryNodesEditor.this));
        }
    });
    createMenu.add(new AbstractAction(Lang.get("editor.panel.logical"),
            new ImageIcon(Icons.getImage("LogicalNode", 16))) {

        @Override
        public void actionPerformed(ActionEvent e) {
            addNode(new StoryLogicalNodeEditor(StoryNodesEditor.this));
        }
    });
    return createMenu;
}

From source file:view.MainWindow.java

private void setupTreePopups() {
    jtOpenedDocuments.addMouseListener(new MouseAdapter() {
        @Override/*from   w ww . j  ava 2  s. c  o m*/
        public void mouseClicked(MouseEvent e) {

            if (SwingUtilities.isRightMouseButton(e)) {
                JPopupMenu popup = new JPopupMenu();
                if (null != jtOpenedDocuments.getSelectionRows()) {
                    if (1 >= jtOpenedDocuments.getSelectionRows().length) {
                        int row = jtOpenedDocuments.getClosestRowForLocation(e.getX(), e.getY());
                        jtOpenedDocuments.setSelectionRow(row);
                    } else {
                        int row = jtOpenedDocuments.getClosestRowForLocation(e.getX(), e.getY());
                        boolean selected = false;
                        for (int i : jtOpenedDocuments.getSelectionRows()) {
                            if (i == row) {
                                selected = true;
                                break;
                            }
                        }
                        if (!selected) {
                            jtOpenedDocuments.setSelectionRow(row);
                        }
                    }

                    JMenuItem m = null;
                    ActionListener open = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            loadPdf(getSelectedFile(jtOpenedDocuments), true);
                        }
                    };

                    ActionListener remove = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            closeDocument(true);
                        }
                    };

                    ActionListener removeOthers = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            final ArrayList<File> alFilesToClose = new ArrayList<>();
                            boolean showDialog = false;
                            for (File file : getOpenedFiles()) {
                                if (!getSelectedOpenedFiles().contains(file)) {
                                    alFilesToClose.add(file);
                                    if (file.equals(openedFile)) {
                                        showDialog = true;
                                    }
                                }
                            }
                            closeDocuments(alFilesToClose, showDialog);
                        }
                    };

                    ActionListener removeAll = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            closeDocuments(getOpenedFiles(), true);
                        }
                    };

                    ActionListener show = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            try {
                                Desktop.getDesktop().open(getSelectedFile(jtOpenedDocuments).getParentFile());
                            } catch (IOException ex) {
                                Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
                            }
                        }
                    };

                    if (!openedFile.equals(getSelectedFile(jtOpenedDocuments))) {
                        m = new JMenuItem(Bundle.getBundle().getString("menuItem.open"));
                        m.addActionListener(open);
                        popup.add(m);
                    }
                    m = new JMenuItem(getSelectedOpenedFiles().size() > 1
                            ? Bundle.getBundle().getString("menuItem.removeTheseLoadedDocuments")
                            : Bundle.getBundle().getString("menuItem.removeThisLoadedDocument"));
                    m.addActionListener(remove);
                    popup.add(m);
                    if (getOpenedFiles().size() > 1) {
                        m = new JMenuItem(Bundle.getBundle().getString("menuItem.removeOtherLoadedDocuments"));
                        m.addActionListener(removeOthers);
                        popup.add(m);
                        m = new JMenuItem(Bundle.getBundle().getString("menuItem.removeAllLoadedDocuments"));
                        m.addActionListener(removeAll);
                        popup.add(m);
                    }
                    if (getSelectedOpenedFiles().size() == 1) {
                        m = new JMenuItem(Bundle.getBundle().getString("menuItem.showInExplorer"));
                        m.addActionListener(show);
                        popup.add(m);
                    }

                    popup.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }
    });

    jtExplorer.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {

            if (SwingUtilities.isRightMouseButton(e)) {
                JPopupMenu popup = new JPopupMenu();
                if (null != jtExplorer.getSelectionRows()) {
                    if (1 >= jtExplorer.getSelectionRows().length) {
                        int row = jtExplorer.getClosestRowForLocation(e.getX(), e.getY());
                        jtExplorer.setSelectionRow(row);
                    } else {
                        int row = jtExplorer.getClosestRowForLocation(e.getX(), e.getY());
                        boolean selected = false;
                        for (int i : jtExplorer.getSelectionRows()) {
                            if (i == row) {
                                selected = true;
                                break;
                            }
                        }
                        if (!selected) {
                            jtExplorer.setSelectionRow(row);
                        }
                    }

                    JMenuItem m = null;
                    ActionListener loadFile = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            if (jtExplorer.getSelectionRows().length == 1) {
                                loadPdf(getSelectedFile(jtExplorer), true);
                            } else {
                                ArrayList<File> sl = getMultipleSelectedFiles(jtExplorer);
                                for (File f : sl) {
                                    loadPdf(f, false);
                                }
                            }
                        }
                    };
                    ActionListener loadFolder = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            if (jtExplorer.getSelectionRows().length == 1) {
                                File f = getSelectedFile(jtExplorer);
                                loadFolder(f, false);
                            } else {
                                ArrayList<File> sl = getMultipleSelectedFiles(jtExplorer);
                                for (File f : sl) {
                                    loadFolder(f, false);
                                }
                            }
                        }
                    };
                    ActionListener loadFolderRecursively = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            if (jtExplorer.getSelectionRows().length == 1) {
                                File f = getSelectedFile(jtExplorer);
                                loadFolder(f, true);
                            } else {
                                ArrayList<File> sl = getMultipleSelectedFiles(jtExplorer);
                                for (File s : sl) {
                                    loadFolder(s, true);
                                }
                            }
                        }
                    };
                    ActionListener remove = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            ArrayList<File> listaF = getMultipleSelectedFiles(jtExplorer);
                            closeDocuments(listaF, true);
                        }
                    };

                    ActionListener show = new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            try {
                                Desktop.getDesktop()
                                        .open(getSelectedFile(jtExplorer).isFile()
                                                ? getSelectedFile(jtExplorer).getParentFile()
                                                : getSelectedFile(jtExplorer));
                            } catch (IOException ex) {
                                Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
                            }
                        }
                    };

                    if (files.isEmpty()) {
                        if (jtExplorer.getSelectionRows().length <= 1) {
                            File f = getSelectedFile(jtExplorer);
                            if (f.isDirectory()) {
                                m = new JMenuItem(
                                        Bundle.getBundle().getString("menuItem.openDocumentsInThisFolder"));
                                m.addActionListener(loadFolder);
                                popup.add(m);
                                m = new JMenuItem(Bundle.getBundle()
                                        .getString("menuItem.openDocumentsThisFolderRecursive"));
                                m.addActionListener(loadFolderRecursively);
                                popup.add(m);
                                m = new JMenuItem(Bundle.getBundle().getString("menuItem.showInExplorer"));
                                m.addActionListener(show);
                                popup.add(m);
                            } else {
                                m = new JMenuItem(Bundle.getBundle().getString("menuItem.openDocument"));
                                m.addActionListener(loadFile);
                                popup.add(m);
                                m = new JMenuItem(Bundle.getBundle().getString("menuItem.showInExplorer"));
                                m.addActionListener(show);
                                popup.add(m);
                            }

                        } else {
                            ArrayList<File> l = getMultipleSelectedFiles(jtExplorer);
                            boolean file = l.get(0).isFile();
                            boolean allSame = true;
                            for (File f : l) {
                                if (file != f.isFile()) {
                                    allSame = false;
                                    break;
                                }
                            }
                            if (allSame) {
                                if (file) {
                                    m = new JMenuItem(Bundle.getBundle().getString("menuItem.openDocuments"));
                                    m.addActionListener(loadFile);
                                    popup.add(m);
                                } else {
                                    m = new JMenuItem(Bundle.getBundle()
                                            .getString("menuItem.openDocumentsInTheseFolders"));
                                    m.addActionListener(loadFolder);
                                    popup.add(m);
                                }
                            }
                        }
                    } else {
                        File f = getSelectedFile(jtExplorer);
                        if (f.isDirectory()) {
                            m = new JMenuItem(
                                    Bundle.getBundle().getString("menuItem.openDocumentsInThisFolder"));
                            m.addActionListener(loadFolder);
                            popup.add(m);
                            m = new JMenuItem(
                                    Bundle.getBundle().getString("menuItem.openDocumentsThisFolderRecursive"));
                            m.addActionListener(loadFolderRecursively);
                            popup.add(m);
                        } else if (files.contains(getSelectedFile(jtExplorer))) {
                            m = new JMenuItem(
                                    Bundle.getBundle().getString("menuItem.removeFromLoadedDocuments"));
                            m.addActionListener(remove);
                            popup.add(m);
                        } else {
                            m = new JMenuItem(Bundle.getBundle().getString("menuItem.addToLoadedDocuments"));
                            m.addActionListener(loadFile);
                            popup.add(m);
                        }
                    }
                    popup.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }
    });

    jtExplorer.setCellRenderer(new TooltipTreeCellRenderer());
    ToolTipManager.sharedInstance().registerComponent(jtExplorer);

    FileListTreeCellRenderer renderer1 = new FileListTreeCellRenderer((MainWindow) this);
    jtOpenedDocuments.setCellRenderer(renderer1);
    ToolTipManager.sharedInstance().registerComponent(jtOpenedDocuments);
}

From source file:view.WorkspacePanel.java

private void btnValidateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnValidateActionPerformed
    if (mainWindow.getOpenedFiles().size() > 1) {
        JPopupMenu popup = new JPopupMenu();
        JMenuItem m = null;//from   w  ww  . j ava 2  s .c  o m
        ActionListener validateOne = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (!rightPanel.isVisible()) {
                    changeCard(CardEnum.VALIDATE_PANEL, true);
                    startValidationThread();
                } else if (WorkspacePanel.this.status == WorkspacePanel.Status.SIGNING) {
                    String msg = Bundle.getBundle().getString("yes");
                    Object[] options = { Bundle.getBundle().getString("msg.signatureStillNotAppliedCancel1"),
                            Bundle.getBundle().getString("no") };
                    int opt = JOptionPane.showOptionDialog(null, msg, "", JOptionPane.DEFAULT_OPTION,
                            JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
                    if (opt == JOptionPane.YES_OPTION) {
                        status = Status.READY;
                        changeCard(CardEnum.VALIDATE_PANEL, true);
                        startValidationThread();
                    }
                }
            }
        };
        ActionListener validateAll = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                MultipleValidationDialog mvd = new MultipleValidationDialog(mainWindow, true,
                        mainWindow.getOpenedFiles());
                mvd.setLocationRelativeTo(null);
                mvd.setVisible(true);
            }
        };
        int numSigs = CCInstance.getInstance().getNumberOfSignatures(document.getDocumentLocation());
        if (numSigs == 0) {
            m = new JMenuItem(Bundle.getBundle().getString("notSigned"));
            m.addActionListener(validateOne);
            m.setEnabled(false);
            popup.add(m);
        } else {
            m = new JMenuItem(Bundle.getBundle().getString("menuItem.validateOnlyThis"));
            m.addActionListener(validateOne);
            popup.add(m);
        }

        if (mainWindow.getSelectedOpenedFiles().size() > 1
                && mainWindow.getSelectedOpenedFiles().size() < mainWindow.getOpenedFiles().size()) {
            m = new JMenuItem(Bundle.getBundle().getString("menuItem.validateAllSelected"));
            m.addActionListener(validateAll);
            popup.add(m);
            m = new JMenuItem(Bundle.getBundle().getString("menuItem.validateAll"));
            m.addActionListener(validateAll);
            popup.add(m);
        } else {
            m = new JMenuItem(Bundle.getBundle().getString("menuItem.validateAll"));
            m.addActionListener(validateAll);
            popup.add(m);
        }

        popup.setLightWeightPopupEnabled(true);
        popup.show(btnValidate, 0, btnValidate.getHeight());

    } else if (!rightPanel.isVisible()) {
        changeCard(CardEnum.VALIDATE_PANEL, true);
        startValidationThread();
    } else if (WorkspacePanel.this.status == WorkspacePanel.Status.SIGNING) {
        String msg = Bundle.getBundle().getString("msg.signatureStillNotAppliedCancel1");
        Object[] options = { Bundle.getBundle().getString("yes"), Bundle.getBundle().getString("no") };
        int opt = JOptionPane.showOptionDialog(null, msg, "", JOptionPane.DEFAULT_OPTION,
                JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
        if (opt == JOptionPane.YES_OPTION) {
            status = Status.READY;
            changeCard(CardEnum.VALIDATE_PANEL, true);
            startValidationThread();
        } else {
            return;
        }
    }
    removeTempSignature();
}