JavaTM Platform
Standard Ed. 6

javax.swing.tree
인터페이스 TreeCellRenderer

기존의 구현 클래스의 일람:
DefaultTreeCellRenderer


public interface TreeCellRenderer

트리 노드를 표시하는 객체의 요건을 정의합니다. 커스텀 아이콘을 표시하는 트리 셀 렌더링의 구현예는, 「The Java Tutorial」의「How to Use Trees」를 참조해 주세요.


메소드의 개요
 Component getTreeCellRendererComponent (JTree  tree, Object  value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
          현재의 트리 셀의 값을 value 로 설정합니다.
 

메소드의 상세

getTreeCellRendererComponent

Component  getTreeCellRendererComponent(JTree  tree,
                                       Object  value,
                                       boolean selected,
                                       boolean expanded,
                                       boolean leaf,
                                       int row,
                                       boolean hasFocus)
현재의 트리 셀의 값을 value 로 설정합니다. selected 가 true 의 경우는, 셀은 선택되고 있는 것으로서 draw 됩니다. expanded 가 true 이면, 노드는 현재 전개되고 있습니다. leaf 가 true 이면, 노드는 잎을 나타냅니다. hasFocus 가 true 이면, 노드에 현재 포커스가 있습니다. treeJTree 의 경우, 리시버는 설정중입니다. 렌더링이 값을 draw 하는데 사용하는 Component 를 돌려줍니다.

트리의 현재의 드래그&드롭 위치를 나타내는 셀이 있으면,TableCellRenderer 도 이 셀을 draw 하기 위해서 사용됩니다. 이 렌더링이 드래그&드롭 위치의 draw를 고려하는 경우, 트리를 직접 조회해, 지정의 행이 드롭 위치를 나타내고 있는지 어떤지를 확인하게 되어 있습니다.

     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
     }
 

반환값:
렌더링이 값을 draw 하는데 사용하는 Component

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.