TreeCellRenderer () { return new ColoredTreeCellRenderer() { @Override public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { if (value instanceof ElementNode) { ((ElementNode) value).getDelegate().renderTreeNode(this, tree); } } }; }