Example usage for javax.swing.event PopupMenuListener PopupMenuListener

List of usage examples for javax.swing.event PopupMenuListener PopupMenuListener

Introduction

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

Prototype

PopupMenuListener

Source Link

Usage

From source file:processing.app.EditorTab.java

private void configurePopupMenu(final SketchTextArea textarea) {

    JPopupMenu menu = textarea.getPopupMenu();

    menu.addSeparator();/*from w  ww.  j a  va2 s. c  o  m*/

    JMenuItem item = editor.createToolMenuItem("cc.arduino.packages.formatter.AStyle");
    if (item == null) {
        throw new NullPointerException("Tool cc.arduino.packages.formatter.AStyle unavailable");
    }
    item.setName("menuToolsAutoFormat");

    menu.add(item);

    item = new JMenuItem(tr("Comment/Uncomment"), '/');
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleCommentUncomment();
        }
    });
    menu.add(item);

    item = new JMenuItem(tr("Increase Indent"), ']');
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleIndentOutdent(true);
        }
    });
    menu.add(item);

    item = new JMenuItem(tr("Decrease Indent"), '[');
    item.setName("menuDecreaseIndent");
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleIndentOutdent(false);
        }
    });
    menu.add(item);

    item = new JMenuItem(tr("Copy for Forum"));
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleDiscourseCopy();
        }
    });
    menu.add(item);

    item = new JMenuItem(tr("Copy as HTML"));
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleHTMLCopy();
        }
    });
    menu.add(item);

    final JMenuItem referenceItem = new JMenuItem(tr("Find in Reference"));
    referenceItem.addActionListener(editor::handleFindReference);
    menu.add(referenceItem);

    final JMenuItem openURLItem = new JMenuItem(tr("Open URL"));
    openURLItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Base.openURL(e.getActionCommand());
        }
    });
    menu.add(openURLItem);

    menu.addPopupMenuListener(new PopupMenuListener() {

        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            String referenceFile = editor.base.getPdeKeywords().getReference(getCurrentKeyword());
            referenceItem.setEnabled(referenceFile != null);

            int offset = textarea.getCaretPosition();
            org.fife.ui.rsyntaxtextarea.Token token = RSyntaxUtilities.getTokenAtOffset(textarea, offset);
            if (token != null && token.isHyperlink()) {
                openURLItem.setEnabled(true);
                openURLItem.setActionCommand(token.getLexeme());
            } else {
                openURLItem.setEnabled(false);
            }
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {
        }
    });

}

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

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Sasha Ivanov
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    panel1 = new JPanel();
    label1 = new JLabel();
    createTypeBtn = new JButton();
    editTypeBtn = new JButton();
    removeTypeBtn = new JButton();
    label2 = new JLabel();
    joinManufactorsBtn = new JButton();
    createManufactorBtn = new JButton();
    editManufactorBtn = new JButton();
    removeManufactorBtn = new JButton();
    label3 = new JLabel();
    joinSeriesBtn = new JButton();
    createSeriaBtn = new JButton();
    editSeriaBtn = new JButton();
    removeSeriaBtn = new JButton();
    scrollPane1 = new JScrollPane();
    vechicleTypesList = new JList();
    scrollPane2 = new JScrollPane();
    manufactorsList = new JList();
    scrollPane3 = new JScrollPane();
    seriesList = new JList();
    panel10 = new JPanel();
    label5 = new JLabel();
    createMotorBtn = new JButton();
    editMotorBtn = new JButton();
    removeMotorBtn = new JButton();
    joinMotorsBtn = new JButton();
    scrollPane4 = new JScrollPane();
    motorsTable = new JTable();
    panel3 = new JPanel();
    label6 = new JLabel();
    label7 = new JLabel();
    panel4 = new JPanel();
    label4 = compFactory.createLabel("\u0424\u0438\u043b\u044c\u0442\u0440");
    filterSearchField = new JTextField();
    filterSearchBtn = new JButton();
    scrollPane5 = new JScrollPane();
    filtersTable = new JTable();
    filterRelationComment = new JButton();
    attachFilterBtn = new JButton();
    scrollPane6 = new JScrollPane();
    allFiltersTable = new JTable();
    detachFilterBtn = new JButton();
    listsPopupMenu = new JPopupMenu();
    miCopyToExcel = new JMenuItem();
    miExportToExcel = new JMenuItem();
    menuItem1 = new JMenuItem();
    menuItem3 = new JMenuItem();
    menuItem2 = new JMenuItem();
    menuItem4 = new JMenuItem();
    CellConstraints cc = new CellConstraints();

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

    // JFormDesigner evaluation mark
    setBorder(//w  w w.  ja  va  2 s  .c om
            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"));

    //======== panel1 ========
    {
        panel1.setLayout(new FormLayout(
                "default:grow, $lcgap, 3*(21pt), $lcgap, default:grow, $lcgap, 21dlu, $lcgap, 3*(21pt), $lcgap, default:grow, $lcgap, 21dlu, $lcgap, 3*(21pt)",
                "fill:21pt, fill:50dlu:grow, $lgap, min, fill:100dlu:grow, $lgap, fill:80dlu:grow"));

        //---- label1 ----
        label1.setText("\u0422\u0438\u043f \u0422\u0421");
        label1.setFont(label1.getFont().deriveFont(label1.getFont().getStyle() | Font.BOLD));
        panel1.add(label1, cc.xy(1, 1));

        //---- createTypeBtn ----
        createTypeBtn.setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
        createTypeBtn.setAlignmentY(0.0F);
        createTypeBtn.setToolTipText(
                "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430");
        createTypeBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                createTypeBtnActionPerformed(e);
            }
        });
        panel1.add(createTypeBtn, cc.xy(3, 1));

        //---- editTypeBtn ----
        editTypeBtn.setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
        editTypeBtn.setToolTipText(
                "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430");
        editTypeBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                editTypeBtnActionPerformed(e);
            }
        });
        panel1.add(editTypeBtn, cc.xy(4, 1));

        //---- removeTypeBtn ----
        removeTypeBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
        removeTypeBtn.setToolTipText(
                "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430");
        removeTypeBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                removeTypeBtnActionPerformed(e);
            }
        });
        panel1.add(removeTypeBtn, cc.xy(5, 1));

        //---- label2 ----
        label2.setText("\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c");
        label2.setFont(label2.getFont().deriveFont(label2.getFont().getStyle() | Font.BOLD));
        panel1.add(label2, cc.xy(7, 1));

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

        //---- createManufactorBtn ----
        createManufactorBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
        createManufactorBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                createManufactorBtnActionPerformed(e);
            }
        });
        panel1.add(createManufactorBtn, cc.xy(11, 1));

        //---- editManufactorBtn ----
        editManufactorBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
        editManufactorBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                editManufactorBtnActionPerformed(e);
            }
        });
        panel1.add(editManufactorBtn, cc.xy(12, 1));

        //---- removeManufactorBtn ----
        removeManufactorBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
        removeManufactorBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                removeManufactorBtnActionPerformed(e);
            }
        });
        panel1.add(removeManufactorBtn, cc.xy(13, 1));

        //---- label3 ----
        label3.setText("\u0421\u0435\u0440\u0438\u044f");
        label3.setFont(label3.getFont().deriveFont(label3.getFont().getStyle() | Font.BOLD));
        panel1.add(label3, cc.xy(15, 1));

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

        //---- createSeriaBtn ----
        createSeriaBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
        createSeriaBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                createSeriaBtnActionPerformed(e);
            }
        });
        panel1.add(createSeriaBtn, cc.xy(19, 1));

        //---- editSeriaBtn ----
        editSeriaBtn.setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
        editSeriaBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                editSeriaBtnActionPerformed(e);
            }
        });
        panel1.add(editSeriaBtn, cc.xy(20, 1));

        //---- removeSeriaBtn ----
        removeSeriaBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
        removeSeriaBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                removeSeriaBtnActionPerformed(e);
            }
        });
        panel1.add(removeSeriaBtn, cc.xy(21, 1));

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

            //---- vechicleTypesList ----
            vechicleTypesList.setDoubleBuffered(true);
            vechicleTypesList.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    vechicleTypesListValueChanged(e);
                }
            });
            vechicleTypesList.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    vechicleTypesListKeyPressed(e);
                }
            });
            vechicleTypesList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    vechicleTypesListMouseClicked(e);
                }
            });
            scrollPane1.setViewportView(vechicleTypesList);
        }
        panel1.add(scrollPane1, cc.xywh(1, 2, 5, 1));

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

            //---- manufactorsList ----
            manufactorsList.setDoubleBuffered(true);
            manufactorsList.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    manufactorsListValueChanged(e);
                }
            });
            manufactorsList.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    manufactorsListKeyPressed(e);
                }
            });
            manufactorsList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    manufactorsListMouseClicked(e);
                }
            });
            scrollPane2.setViewportView(manufactorsList);
        }
        panel1.add(scrollPane2, cc.xywh(7, 2, 7, 1));

        //======== scrollPane3 ========
        {

            //---- seriesList ----
            seriesList.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    seriesListValueChanged(e);
                }
            });
            seriesList.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    seriesListKeyPressed(e);
                }
            });
            seriesList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    seriesListMouseClicked(e);
                }
            });
            scrollPane3.setViewportView(seriesList);
        }
        panel1.add(scrollPane3, cc.xywh(15, 2, 7, 1));

        //======== panel10 ========
        {
            panel10.setLayout(new FormLayout("default, $lcgap, 4*(21dlu)", "default"));

            //---- label5 ----
            label5.setText("\u0414\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438");
            label5.setFont(label5.getFont().deriveFont(label5.getFont().getStyle() | Font.BOLD));
            panel10.add(label5, cc.xy(1, 1));

            //---- createMotorBtn ----
            createMotorBtn
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
            createMotorBtn.setAlignmentY(0.0F);
            createMotorBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    createMotorBtnActionPerformed(e);
                }
            });
            panel10.add(createMotorBtn, cc.xy(3, 1));

            //---- editMotorBtn ----
            editMotorBtn
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
            editMotorBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    editMotorBtnActionPerformed(e);
                }
            });
            panel10.add(editMotorBtn, cc.xy(4, 1));

            //---- removeMotorBtn ----
            removeMotorBtn.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
            removeMotorBtn.setEnabled(false);
            removeMotorBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    removeMotorBtnActionPerformed(e);
                }
            });
            panel10.add(removeMotorBtn, cc.xy(5, 1));

            //---- joinMotorsBtn ----
            joinMotorsBtn.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/recycle_24.png")));
            joinMotorsBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    joinMotorsBtnActionPerformed(e);
                }
            });
            panel10.add(joinMotorsBtn, cc.xy(6, 1));
        }
        panel1.add(panel10, cc.xywh(1, 4, 21, 1));

        //======== scrollPane4 ========
        {

            //---- motorsTable ----
            motorsTable.setAutoCreateRowSorter(true);
            motorsTable.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    motorsTableKeyPressed(e);
                }
            });
            motorsTable.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    motorsTableMouseClicked(e);
                }
            });
            scrollPane4.setViewportView(motorsTable);
        }
        panel1.add(scrollPane4, cc.xywh(1, 5, 21, 1));

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

            //---- label6 ----
            label6.setText(
                    "\u041f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b");
            label6.setFont(label6.getFont().deriveFont(label6.getFont().getStyle() | Font.BOLD));
            panel3.add(label6, cc.xy(1, 1));

            //---- label7 ----
            label7.setText("\u0412\u0441\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b");
            label7.setFont(label7.getFont().deriveFont(label7.getFont().getStyle() | Font.BOLD));
            panel3.add(label7, cc.xy(5, 1));

            //======== panel4 ========
            {
                panel4.setLayout(new FormLayout("default, $lcgap, default:grow, 21pt", "21dlu"));
                panel4.add(label4, cc.xy(1, 1));

                //---- filterSearchField ----
                filterSearchField.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        filterSearchFieldKeyPressed(e);
                    }
                });
                panel4.add(filterSearchField, cc.xy(3, 1));

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

            //======== scrollPane5 ========
            {

                //---- filtersTable ----
                filtersTable.setAutoCreateRowSorter(true);
                filtersTable.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent e) {
                        filtersTableMouseClicked(e);
                    }
                });
                scrollPane5.setViewportView(filtersTable);
            }
            panel3.add(scrollPane5, cc.xywh(1, 2, 1, 6));

            //---- filterRelationComment ----
            filterRelationComment
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit.png")));
            filterRelationComment.setToolTipText(
                    "\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043a \u0444\u0438\u043b\u044c\u0442\u0440\u0443 \u0443 \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b");
            filterRelationComment.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    filterRelationCommentActionPerformed(e);
                }
            });
            panel3.add(filterRelationComment, cc.xy(3, 2));

            //---- attachFilterBtn ----
            attachFilterBtn.setIcon(new ImageIcon(
                    getClass().getResource("/ru/goodfil/catalog/ui/icons/arrow_left_green_24.png")));
            attachFilterBtn.setToolTipText(
                    "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0441\u0442\u044c");
            attachFilterBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    attachFilterBtnActionPerformed(e);
                }
            });
            panel3.add(attachFilterBtn, cc.xy(3, 3));

            //======== scrollPane6 ========
            {

                //---- allFiltersTable ----
                allFiltersTable.setAutoCreateRowSorter(true);
                allFiltersTable.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent e) {
                        allFiltersTableMouseClicked(e);
                    }
                });
                scrollPane6.setViewportView(allFiltersTable);
            }
            panel3.add(scrollPane6, cc.xywh(5, 3, 1, 5));

            //---- detachFilterBtn ----
            detachFilterBtn.setIcon(new ImageIcon(
                    getClass().getResource("/ru/goodfil/catalog/ui/icons/arrow_right_green_24.png")));
            detachFilterBtn.setToolTipText(
                    "\u0423\u0431\u0440\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0441\u0442\u0438");
            detachFilterBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    detachFilterBtnActionPerformed(e);
                }
            });
            panel3.add(detachFilterBtn, cc.xy(3, 5));
        }
        panel1.add(panel3, cc.xywh(1, 7, 21, 1));
    }
    add(panel1, cc.xy(1, 1));

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

            @Override
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            }

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

        //---- miCopyToExcel ----
        miCopyToExcel.setText("\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Excel");
        miCopyToExcel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                miCopyToExcelActionPerformed(e);
            }
        });
        listsPopupMenu.add(miCopyToExcel);

        //---- miExportToExcel ----
        miExportToExcel.setText("\u0412\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 Excel");
        miExportToExcel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                miExportToExcelActionPerformed(e);
            }
        });
        listsPopupMenu.add(miExportToExcel);
        listsPopupMenu.addSeparator();

        //---- 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);
            }
        });
        listsPopupMenu.add(menuItem1);

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

        //---- menuItem2 ----
        menuItem2.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)");
        menuItem2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                cutToClipboard(e);
            }
        });
        listsPopupMenu.add(menuItem2);

        //---- 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);
            }
        });
        listsPopupMenu.add(menuItem4);
    }
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

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 w w  w . j  a  v a 2 s  . c o  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(/* w  w  w .  ja  v  a2 s .c  o  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, $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:savant.view.swing.NavigationBar.java

NavigationBar() {

    this.setOpaque(false);
    this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    String buttonStyle = "segmentedCapsule";

    String shortcutMod = MiscUtils.MAC ? "Cmd" : "Ctrl";

    add(getRigidPadding());//from  ww w  .  ja v  a 2  s. c  o  m

    JButton loadGenomeButton = (JButton) add(new JButton(""));
    loadGenomeButton.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.GENOME));
    loadGenomeButton.setToolTipText("Load or change genome");
    loadGenomeButton.setFocusable(false);
    loadGenomeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Savant.getInstance().showOpenGenomeDialog();
        }
    });
    loadGenomeButton.putClientProperty("JButton.buttonType", buttonStyle);
    loadGenomeButton.putClientProperty("JButton.segmentPosition", "first");
    loadGenomeButton.setPreferredSize(ICON_SIZE);
    loadGenomeButton.setMinimumSize(ICON_SIZE);
    loadGenomeButton.setMaximumSize(ICON_SIZE);

    JButton loadTrackButton = (JButton) add(new JButton(""));
    loadTrackButton.setFocusable(false);
    loadTrackButton.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.TRACK));
    loadTrackButton.setToolTipText("Load a track");
    loadTrackButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Savant.getInstance().openTrack();
        }
    });
    loadTrackButton.putClientProperty("JButton.buttonType", buttonStyle);
    loadTrackButton.putClientProperty("JButton.segmentPosition", "last");
    loadTrackButton.setPreferredSize(ICON_SIZE);
    loadTrackButton.setMinimumSize(ICON_SIZE);
    loadTrackButton.setMaximumSize(ICON_SIZE);

    if (!Savant.getInstance().isStandalone()) {
        add(loadGenomeButton);
        add(loadTrackButton);
        add(getRigidPadding());
        add(getRigidPadding());
    } else {
        loadGenomeButton.setVisible(false);
        loadTrackButton.setVisible(false);
    }

    JLabel rangeText = new JLabel("Location ");
    add(rangeText);

    String[] a = { " ", " ", " ", " ", " ", " ", " ", " ", " ", " " };
    locationField = new JComboBox(a);
    locationField.setEditable(true);
    locationField.setRenderer(new ReferenceListRenderer());

    // When the item is chosen from the menu, navigate to the given feature/reference.
    locationField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            if (!currentlyPopulating) {
                if (ae.getActionCommand().equals("comboBoxChanged")) {
                    // Assumes that combo-box items created by populateCombo() are of the form "GENE (chrX:1-1000)".
                    String itemText = locationField.getSelectedItem().toString();
                    int lastBracketPos = itemText.lastIndexOf('(');
                    if (lastBracketPos > 0) {
                        itemText = itemText.substring(lastBracketPos + 1, itemText.length() - 1);
                    }
                    setRangeFromText(itemText);

                }
            }
        }
    });

    // When the combo-box is popped open, we may want to repopulate the menu.
    locationField.addPopupMenuListener(new PopupMenuListener() {
        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent pme) {
            String text = (String) locationField.getEditor().getItem();
            if (!text.equals(lastPoppedUp)) {
                try {
                    // Building the menu could take a while.
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    populateCombo();
                } finally {
                    setCursor(Cursor.getDefaultCursor());
                }
            }
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent pme) {
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent pme) {
        }
    });

    // Add our special keystroke-handling to the JComboBox' text-field.
    // We have to turn off default tab-handling so that tab can pop up our list.
    Component textField = locationField.getEditor().getEditorComponent();
    textField.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
    textField.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            if (evt.getKeyCode() == KeyEvent.VK_TAB) {
                locationField.showPopup();
            } else if (evt.getModifiers() == KeyEvent.SHIFT_MASK) {
                switch (evt.getKeyCode()) {
                case KeyEvent.VK_LEFT:
                    locationController.shiftRangeLeft();
                    evt.consume();
                    break;
                case KeyEvent.VK_RIGHT:
                    locationController.shiftRangeRight();
                    evt.consume();
                    break;
                case KeyEvent.VK_UP:
                    locationController.zoomIn();
                    evt.consume();
                    break;
                case KeyEvent.VK_DOWN:
                    locationController.zoomOut();
                    evt.consume();
                    break;
                case KeyEvent.VK_HOME:
                    locationController.shiftRangeFarLeft();
                    evt.consume();
                    break;
                case KeyEvent.VK_END:
                    locationController.shiftRangeFarRight();
                    evt.consume();
                    break;
                }
            }
        }
    });
    add(locationField);
    locationField.setToolTipText("Current display range");
    locationField.setPreferredSize(LOCATION_SIZE);
    locationField.setMaximumSize(LOCATION_SIZE);
    locationField.setMinimumSize(LOCATION_SIZE);

    add(getRigidPadding());

    JButton goButton = (JButton) add(new JButton("  Go  "));
    goButton.putClientProperty("JButton.buttonType", buttonStyle);
    goButton.putClientProperty("JButton.segmentPosition", "only");
    goButton.setToolTipText("Go to specified range (Enter)");
    goButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setRangeFromText(locationField.getEditor().getItem().toString());
        }
    });

    add(getRigidPadding());

    JLabel l = new JLabel("Length: ");
    add(l);

    lengthLabel = (JLabel) add(new JLabel());
    lengthLabel.setToolTipText("Length of the current range");
    lengthLabel.setPreferredSize(LENGTH_SIZE);
    lengthLabel.setMaximumSize(LENGTH_SIZE);
    lengthLabel.setMinimumSize(LENGTH_SIZE);

    add(Box.createGlue());

    double screenwidth = Toolkit.getDefaultToolkit().getScreenSize().getWidth();

    JButton afterGo = null;
    //if (screenwidth > 800) {
    final JButton undoButton = (JButton) add(new JButton(""));
    afterGo = undoButton;
    undoButton.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.UNDO));
    undoButton.setToolTipText("Undo range change (" + shortcutMod + "+Z)");
    undoButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            locationController.undoLocationChange();
        }
    });
    undoButton.putClientProperty("JButton.buttonType", buttonStyle);
    undoButton.putClientProperty("JButton.segmentPosition", "first");
    undoButton.setPreferredSize(ICON_SIZE);
    undoButton.setMinimumSize(ICON_SIZE);
    undoButton.setMaximumSize(ICON_SIZE);

    final JButton redo = (JButton) add(new JButton(""));
    redo.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.REDO));
    redo.setToolTipText("Redo range change (" + shortcutMod + "+Y)");
    redo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            locationController.redoLocationChange();
        }
    });
    redo.putClientProperty("JButton.buttonType", buttonStyle);
    redo.putClientProperty("JButton.segmentPosition", "last");
    redo.setPreferredSize(ICON_SIZE);
    redo.setMinimumSize(ICON_SIZE);
    redo.setMaximumSize(ICON_SIZE);
    //}

    add(getRigidPadding());
    add(getRigidPadding());

    final JButton zoomInButton = (JButton) add(new JButton());
    if (afterGo == null) {
        afterGo = zoomInButton;
    }
    zoomInButton.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.ZOOMIN));
    zoomInButton.putClientProperty("JButton.buttonType", buttonStyle);
    zoomInButton.putClientProperty("JButton.segmentPosition", "first");
    zoomInButton.setPreferredSize(ICON_SIZE);
    zoomInButton.setMinimumSize(ICON_SIZE);
    zoomInButton.setMaximumSize(ICON_SIZE);
    zoomInButton.setToolTipText("Zoom in (Shift+Up)");
    zoomInButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            locationController.zoomIn();
            AnalyticsAgent.log(new NameValuePair[] { new NameValuePair("navigation-event", "zoomed"),
                    new NameValuePair("navigation-direction", "in"),
                    new NameValuePair("navigation-modality", "navbar") });
        }
    });

    final JButton zoomOut = (JButton) add(new JButton(""));
    zoomOut.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.ZOOMOUT));
    zoomOut.setToolTipText("Zoom out (Shift+Down)");
    zoomOut.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            locationController.zoomOut();
            AnalyticsAgent.log(new NameValuePair[] { new NameValuePair("navigation-event", "zoomed"),
                    new NameValuePair("navigation-direction", "out"),
                    new NameValuePair("navigation-modality", "navbar") });
        }
    });
    zoomOut.putClientProperty("JButton.buttonType", buttonStyle);
    zoomOut.putClientProperty("JButton.segmentPosition", "last");
    zoomOut.setPreferredSize(ICON_SIZE);
    zoomOut.setMinimumSize(ICON_SIZE);
    zoomOut.setMaximumSize(ICON_SIZE);

    add(getRigidPadding());
    add(getRigidPadding());

    final JButton shiftFarLeft = (JButton) add(new JButton());
    shiftFarLeft.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.SHIFT_FARLEFT));
    shiftFarLeft.putClientProperty("JButton.buttonType", buttonStyle);
    shiftFarLeft.putClientProperty("JButton.segmentPosition", "first");
    shiftFarLeft.setToolTipText("Move to the beginning of the genome (Shift+Home)");
    shiftFarLeft.setPreferredSize(ICON_SIZE);
    shiftFarLeft.setMinimumSize(ICON_SIZE);
    shiftFarLeft.setMaximumSize(ICON_SIZE);
    shiftFarLeft.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            locationController.shiftRangeFarLeft();
            AnalyticsAgent.log(new NameValuePair[] { new NameValuePair("navigation-event", "panned"),
                    new NameValuePair("navigation-direction", "left"),
                    new NameValuePair("navigation-modality", "navbar") });
        }
    });

    final JButton shiftLeft = (JButton) add(new JButton());
    shiftLeft.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.SHIFT_LEFT));
    shiftLeft.putClientProperty("JButton.buttonType", buttonStyle);
    shiftLeft.putClientProperty("JButton.segmentPosition", "middle");
    shiftLeft.setToolTipText("Move left (Shift+Left)");
    shiftLeft.setPreferredSize(ICON_SIZE);
    shiftLeft.setMinimumSize(ICON_SIZE);
    shiftLeft.setMaximumSize(ICON_SIZE);
    shiftLeft.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            locationController.shiftRangeLeft();
            AnalyticsAgent.log(new NameValuePair[] { new NameValuePair("navigation-event", "panned"),
                    new NameValuePair("navigation-direction", "left"),
                    new NameValuePair("navigation-modality", "navbar") });
        }
    });

    final JButton shiftRight = (JButton) add(new JButton());
    shiftRight.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.SHIFT_RIGHT));
    shiftRight.putClientProperty("JButton.buttonType", buttonStyle);
    shiftRight.putClientProperty("JButton.segmentPosition", "middle");
    shiftRight.setToolTipText("Move right (Shift+Right)");
    shiftRight.setPreferredSize(ICON_SIZE);
    shiftRight.setMinimumSize(ICON_SIZE);
    shiftRight.setMaximumSize(ICON_SIZE);
    shiftRight.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            locationController.shiftRangeRight();
            AnalyticsAgent.log(new NameValuePair[] { new NameValuePair("navigation-event", "panned"),
                    new NameValuePair("navigation-direction", "right"),
                    new NameValuePair("navigation-modality", "navbar") });
        }
    });

    final JButton shiftFarRight = (JButton) add(new JButton());
    shiftFarRight
            .setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.SHIFT_FARRIGHT));
    shiftFarRight.putClientProperty("JButton.buttonType", buttonStyle);
    shiftFarRight.putClientProperty("JButton.segmentPosition", "last");
    shiftFarRight.setToolTipText("Move to the end of the genome (Shift+End)");
    shiftFarRight.setPreferredSize(ICON_SIZE);
    shiftFarRight.setMinimumSize(ICON_SIZE);
    shiftFarRight.setMaximumSize(ICON_SIZE);
    shiftFarRight.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            locationController.shiftRangeFarRight();
            AnalyticsAgent.log(new NameValuePair[] { new NameValuePair("navigation-event", "panned"),
                    new NameValuePair("navigation-direction", "right"),
                    new NameValuePair("navigation-modality", "navbar") });
        }
    });

    add(getRigidPadding());

    locationController.addListener(new Listener<LocationChangedEvent>() {
        @Override
        public void handleEvent(LocationChangedEvent event) {
            updateLocation(event.getReference(), (Range) event.getRange());
        }
    });

    // When the genome changes, we may need to invalidate our menu.
    GenomeController.getInstance().addListener(new Listener<GenomeChangedEvent>() {
        @Override
        public void handleEvent(GenomeChangedEvent event) {
            lastPoppedUp = "INVALID";
        }
    });

    this.addComponentListener(new ComponentListener() {
        @Override
        public void componentResized(ComponentEvent ce) {
            int width = ce.getComponent().getWidth();

            undoButton.setVisible(true);
            redo.setVisible(true);
            zoomInButton.setVisible(true);
            zoomOut.setVisible(true);
            shiftFarLeft.setVisible(true);
            shiftLeft.setVisible(true);
            shiftRight.setVisible(true);
            shiftFarRight.setVisible(true);

            // hide some components if the window isn't wide enough
            if (width < 1200) {
                undoButton.setVisible(false);
                redo.setVisible(false);
            }
            if (width < 1000) {
                shiftFarLeft.setVisible(false);
                shiftFarRight.setVisible(false);

                shiftRight.putClientProperty("JButton.segmentPosition", "last");
                shiftLeft.putClientProperty("JButton.segmentPosition", "first");
            } else {
                shiftRight.putClientProperty("JButton.segmentPosition", "middle");
                shiftLeft.putClientProperty("JButton.segmentPosition", "middle");
            }
        }

        public void componentMoved(ComponentEvent ce) {
        }

        @Override
        public void componentShown(ComponentEvent ce) {
        }

        @Override
        public void componentHidden(ComponentEvent ce) {
        }
    });
}

From source file:sk.stuba.fiit.kvasnicka.topologyvisual.gui.components.DropDownButton.java

private void init(boolean searchFieldEnabled) {

    setIcon(ImageResourceHelper/*from w  w  w  . j  a  v  a  2  s .  c  om*/
            .loadImage("/sk/stuba/fiit/kvasnicka/topologyvisual/resources/files/arrow_down.gif"));
    setHorizontalTextPosition(JButton.LEFT);
    setFocusPainted(false);
    addActionListener(this);
    mainPanel.setLayout(new BorderLayout());

    JPanel northPanel = new JPanel(new BorderLayout());
    if (searchFieldEnabled) {
        addSearchField(northPanel);
    }
    final JCheckBox chSelectAll = new JCheckBox("All");
    chSelectAll.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            selectAll(chSelectAll.isSelected());
        }
    });
    chSelectAll.setAlignmentX(LEFT_ALIGNMENT);

    northPanel.add(chSelectAll, BorderLayout.CENTER);
    northPanel.setAlignmentX(LEFT_ALIGNMENT);
    northPanel.setBackground(Color.red);
    mainPanel.add(northPanel, BorderLayout.NORTH);

    checkPanel.setLayout(new BoxLayout(checkPanel, BoxLayout.PAGE_AXIS));
    scrollPane.setViewportView(checkPanel);
    scrollPane.setPreferredSize(new Dimension(200, 100));

    mainPanel.add(scrollPane, BorderLayout.CENTER);
    popup.add(mainPanel);

    popup.addPopupMenuListener(new PopupMenuListener() {

        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            fireDropDownHiddenEvent(new DropDownHiddenEvent(this, getSelectedCheckBoxItems()));
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {
        }
    });

}