JComponent (@Nullable Icon icon, final SimpleColoredText text, final Runnable expand, @Nullable XFullValueEvaluator evaluator) { SimpleColoredComponent component = HintUtil.createInformationComponent(); component.setIcon(icon != null ? IconManager.getInstance().createRowIcon(UIUtil.getTreeCollapsedIcon(), icon) : UIUtil.getTreeCollapsedIcon()); component.setCursor(hintCursor()); text.appendToComponent(component); appendEvaluatorLink(evaluator, component); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { if (SwingUtilities.isLeftMouseButton(e)) { Object tag = ((SimpleColoredComponent)e.getSource()).getFragmentTagAt(e.getX()); if (tag != null) { if (tag instanceof Consumer consumer) { //noinspection unchecked consumer.accept(e); } else { ((Runnable)tag).run(); } } else { hideCurrentHint(); expand.run(); } return true; } return false; } }.installOn(component); return component; }