void (final JTable table) { new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { if (clickCount >= 2) return false; Component location = table.getComponentAt(e.getPoint()); if (location != null) { onMouseClicked(table); return isAutoScrollMode(); } return false; } }.installOn(table); table.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(final MouseEvent e) { onSelectionChanged(table); } }); table.getSelectionModel().addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { onSelectionChanged(table); } } ); }