private void setPopupMenu(JComponent component){
    
        final JPopupMenu popup = new JPopupMenu();
        JMenuItem menuItemOk = new JMenuItem("Подтвердить заявку");
        JMenuItem menuItemCancel = new JMenuItem("Отменить заявку");
        popup.add(menuItemOk);
        popup.addSeparator();
        popup.add(menuItemCancel);
        
        menuItemOk.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                buttonOkActionPerformed(e);
            }
        });

        menuItemCancel.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                buttonCancelActionPerformed(e);
            }
        });

        //Right mouse click
        component.addMouseListener(new MouseAdapter(){
            public void mouseReleased(MouseEvent event){
                if (event.isPopupTrigger()){
                    popup.show(event.getComponent(), event.getX(), event.getY());
                }
            }
        });
        
        component.add(popup);
    }