public interface TreeCellRenderer 
      Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
value 。 
           如果selected为真,则将像选择一样绘制单元格。 
           如果expanded为真,则节点当前被扩展,并且如果leaf为真,则节点表示叶,并且如果hasFocus为真,则节点当前具有焦点。 
           tree是JTree所述接收器被构造成用于。 
           返回渲染器用来绘制值的Component 。 
            TreeCellRenderer还负责渲染表示树的当前DnD丢弃位置的单元格,如果它有一个。 如果这个渲染器关心渲染DnD放置位置,它应该直接查询树,看看给定的行是否代表放置位置: 
  JTree.DropLocation dropLocation = tree.getDropLocation();
     if (dropLocation != null
             && dropLocation.getChildIndex() == -1
             && tree.getRowForPath(dropLocation.getPath()) == row) {
         // this row represents the current drop location
         // so render it specially, perhaps with a different color
     }  
          Component 
            Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.