void (MouseEvent event, boolean run) { JTextComponent component = getComponent(); if (component != null) { IconHolder result = getIconHolder(component, event.getX(), event.getY()); Runnable action = result == null ? null : result.extension.getActionOnClick(); if (action == null) { setCursor(Cursor.TEXT_CURSOR); } else { setCursor(Cursor.HAND_CURSOR); if (run) { action.run(); //update icon after action is performed getIconHolder(component, event.getX(), event.getY()); event.consume(); } } } }