}
public Component getRendererComponent() {
TreeModel treeModel = tree.getModel();
TreePath treePath = tree.getPathForRow(rowIndex);
TreeCellRenderer renderer = tree.getCellRenderer();
boolean isSelected = tree.isPathSelected(treePath);
boolean isExpanded = tree.isExpanded(treePath);
boolean hasFocus = tree.hasFocus() && rowIndex == tree.getLeadSelectionRow();
Object item = treePath.getLastPathComponent();
boolean isLeaf = treeModel.isLeaf(item);
Component component = renderer.getTreeCellRendererComponent(tree, item, isSelected, isExpanded, isLeaf, rowIndex, hasFocus);
component.setFont(tree.getFont());
return component;
}