public void customizeCellRenderer( final ColoredTreeCellRenderer targetRenderer, CheckedTreeNode node, boolean selected, final boolean checked, boolean expanded, boolean leaf, boolean hasFocus) { targetRenderer.setIcon(PlatformIcons.PACKAGE_ICON); final String displayName; final CheckedTreeNode parent = (CheckedTreeNode) node.getParent(); if (parent != null && parent.getUserObject() instanceof PackageDescriptor) { final String parentPackageInTree = ((PackageDescriptor) parent.getUserObject()).getPackageName() + "."; displayName = myPackageName.startsWith(parentPackageInTree) ? myPackageName.substring(parentPackageInTree.length()) : myPackageName; } else { displayName = myPackageName; } targetRenderer.append( displayName, checked ? SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES); }
protected void customizeCellRenderer( final ColoredTreeCellRenderer targetRenderer, CheckedTreeNode node, boolean selected, final boolean checked, boolean expanded, boolean leaf, boolean hasFocus) { targetRenderer.setIcon(getDisplayIcon()); targetRenderer.append( getDisplayString(), checked ? SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES); }