class HistoryMenuMouseListener extends MouseAdapter {
    private JPopupMenu popup = new JPopupMenu();
    private JTable tableComponent;

    @SuppressWarnings("serial")
    public HistoryMenuMouseListener() {
        Action checkAllAction = new AbstractAction(Utils.getLocalizedString("history.check.all")) {
            @Override
            public void actionPerformed(ActionEvent ae) {
                for (int row = 0; row < tableComponent.getRowCount(); row++) {
                    tableComponent.setValueAt(true, row, 4);
                }
            }
        };
        popup.add(checkAllAction);

        Action uncheckAllAction = new AbstractAction(Utils.getLocalizedString("history.check.none")) {
            @Override
            public void actionPerformed(ActionEvent ae) {
                for (int row = 0; row < tableComponent.getRowCount(); row++) {
                    tableComponent.setValueAt(false, row, 4);
                }
            }
        };
        popup.add(uncheckAllAction);

        popup.addSeparator();

        Action checkSelected = new AbstractAction(Utils.getLocalizedString("history.check.selected")) {
            @Override
            public void actionPerformed(ActionEvent ae) {<FILL_FUNCTION_BODY>}
        };
        popup.add(checkSelected);

        Action uncheckSelected = new AbstractAction(Utils.getLocalizedString("history.uncheck.selected")) {
            @Override
            public void actionPerformed(ActionEvent ae) {
                for (int row : tableComponent.getSelectedRows()) {
                    tableComponent.setValueAt(false, row, 4);
                }
            }
        };
        popup.add(uncheckSelected);
    }

    @Override
    public void mouseClicked(MouseEvent e) {
        if (e.getModifiers() == InputEvent.BUTTON3_MASK) {
            if (!(e.getSource() instanceof JTable)) {
                return;
            }

            tableComponent = (JTable) e.getSource();
            tableComponent.requestFocus();

            int nx = e.getX();

            if (nx > 500) {
                nx = nx - popup.getSize().width;
            }
            popup.show(e.getComponent(), nx, e.getY() - popup.getSize().height);
        }
    }
}

                for (int row : tableComponent.getSelectedRows()) {
                    tableComponent.setValueAt(true, row, 4);
                }
            
<methods>public void mouseClicked(java.awt.event.MouseEvent) ,public void mouseDragged(java.awt.event.MouseEvent) ,public void mouseEntered(java.awt.event.MouseEvent) ,public void mouseExited(java.awt.event.MouseEvent) ,public void mouseMoved(java.awt.event.MouseEvent) ,public void mousePressed(java.awt.event.MouseEvent) ,public void mouseReleased(java.awt.event.MouseEvent) ,public void mouseWheelMoved(java.awt.event.MouseWheelEvent) <variables>