void (@NotNull Runnable onClick) { releaseMouseListener(); AnAction action = new AnAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { onClick.run(); releaseMouseListener(); } }; KeyboardShortcut shortcut = new KeyboardShortcut(KeyStroke.getKeyStroke('l', InputEvent.SHIFT_DOWN_MASK), null); action.registerCustomShortcutSet(new CustomShortcutSet(shortcut), null); MyMouseAdapter listener = new MyMouseAdapter() { @Override public void mouseClicked(MouseEvent e) { onClick.run(); releaseMouseListener(); } @Override public void mouseEntered(MouseEvent e) { updateTable(true); } @Override public void mouseExited(MouseEvent e) { updateTable(false); } @Override void updateTable(boolean mouseOnTable) { setBackground(mouseOnTable ? CLICKABLE_COLOR : JBColor.background()); SimpleTextAttributes linkAttributes = mouseOnTable ? UNDERLINE_LINK_ATTRIBUTES : LINK_ATTRIBUTES; getEmptyText().clear() .appendText(XDebuggerBundle.message("memory.view.no.classes.loaded")).appendText(" ") .appendText(XDebuggerBundle.message("memory.view.load.classes"), linkAttributes).appendText(" "); } }; listener.updateTable(isUnderMouseCursor()); myMouseListener = listener; addMouseListener(myMouseListener); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); }