- 既知のすべての実装クラス:
- DefaultTreeCellRenderer
public interface TreeCellRenderer
ツリー・ノードを表示するオブジェクトの要件を定義します。 カスタム・アイコンを表示するツリー・セル・レンダリングの実装例は、「The Java Tutorial」の「How to Use Trees」を参照してください。 
- 
メソッドのサマリー修飾子と型 メソッド 説明 ComponentgetTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)現在のツリー・セルの値をvalueに設定します。
- 
メソッドの詳細- 
getTreeCellRendererComponentComponent getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)現在のツリー・セルの値をvalueに設定します。selectedがtrueの場合は、セルは選択されているものとして描画されます。expandedがtrueであれば、ノードは現在展開されています。leafがtrueであれば、ノードは葉を表します。hasFocusがtrueであれば、ノードに現在フォーカスがあります。treeがJTreeの場合、レシーバは設定中です。 レンダラが値を描画するのに使うComponentを返します。ツリーの現在のドラッグ&ドロップ位置を示すセルがあれば、 TreeCellRendererもこのセルを描画するために使用されます。 このレンダリングがドラッグ&ドロップ位置の描画を考慮する場合、ツリーを直接照会して、指定の行がドロップ位置を表しているかどうかを確認することになっています。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 }- パラメータ:
- tree- レシーバは、
- value- レンダリングする値
- selected- ノードが選択されているかどうか
- expanded- ノードが展開されているかどうか
- leaf- ノードがリード・ノードかどうか
- row- 行インデックス
- hasFocus- ノードにフォーカスがあるかどうか
- 戻り値:
- レンダリングが値を描画するのに使うComponent
 
 
-