モジュール java.desktop
パッケージ javax.swing.plaf.basic

クラスBasicTreeUI

  • 直系の既知のサブクラス:
    MetalTreeUI, SynthTreeUI

    public class BasicTreeUI
    extends TreeUI
    階層データ構造の基本L&Fです。
    • フィールドの詳細

      • collapsedIcon

        protected transient Icon collapsedIcon
        折りたたまれたアイコン。
      • expandedIcon

        protected transient Icon expandedIcon
        展開されたアイコン。
      • leftChildIndent

        protected int leftChildIndent
        左マージンと垂直の破線が描画される位置の間の距離です。
      • rightChildIndent

        protected int rightChildIndent
        セルの内容が描画される位置を決定するためにleftChildIndentに加算される距離です。
      • totalChildIndent

        protected int totalChildIndent
        インデントされる総距離です。 leftChildIndentとrightChildIndentの合計です。
      • preferredMinSize

        protected Dimension preferredMinSize
        推奨される最小サイズです。
      • lastSelectedRow

        protected int lastSelectedRow
        最後に選択された行のインデックスです。
      • tree

        protected JTree tree
        描画先のコンポーネントです。
      • currentCellRenderer

        protected transient TreeCellRenderer currentCellRenderer
        実際のセルの描画を行うために使われているレンダラです。
      • createdRenderer

        protected boolean createdRenderer
        現在ツリーにあるレンダラがこのインスタンスによって作成された場合にtrueに設定されます。
      • cellEditor

        protected transient TreeCellEditor cellEditor
        ツリーのエディタです。
      • createdCellEditor

        protected boolean createdCellEditor
        現在ツリーにあるエディタがこのインスタンスによって作成された場合にtrueに設定されます。
      • stopEditingInCompleteEditing

        protected boolean stopEditingInCompleteEditing
        編集時に、shouldSelectCell()がtrueを返した場合にfalseに設定されます。これは、completeEditingで使用され、ノードが編集前に選択されなければならないことを意味しています。
      • rendererPane

        protected CellRendererPane rendererPane
        TreeCellRendererをペイントするために使われます。
      • preferredSize

        protected Dimension preferredSize
        すべてのノードを完全に表示するために必要なサイズです。
      • validCachedPreferredSize

        protected boolean validCachedPreferredSize
        preferredSizeが有効かどうかを示します。
      • treeState

        protected AbstractLayoutCache treeState
        サイズ変更や展開されているかどうかを処理するオブジェクトです。
      • drawingCache

        protected Hashtable<TreePath,​Boolean> drawingCache
        垂直線の描画を最小化するために使われます。
      • largeModel

        protected boolean largeModel
        largeModelの最適化を行なっている場合はtrueです。 これをサポートしないサブクラスは、FixedHeightLayoutCacheのインスタンスを返さないようにcreateLayoutCacheをオーバーライドすることをお勧めします。
      • treeModel

        protected TreeModel treeModel
        何を表示するかを決定するために使われます。
      • treeSelectionModel

        protected TreeSelectionModel treeSelectionModel
        選択を維持するモデルです。
      • depthOffset

        protected int depthOffset
        x位置を正確に計算するための深さのオフセットの量です。 これは、ルートが可視かどうか、ルート・ハンドルが可視どうかによって決まります。
      • editingComponent

        protected Component editingComponent
        これは編集時に、実際の編集を行うComponentになります。
      • editingPath

        protected TreePath editingPath
        編集中のパスです。
      • editingRow

        protected int editingRow
        編集中の行です。 editingComponentがnullではない場合だけ参照されます。
      • editorHasDifferentSize

        protected boolean editorHasDifferentSize
        エディタのサイズがレンダラと異なる場合にtrueに設定されます。
    • コンストラクタの詳細

      • BasicTreeUI

        public BasicTreeUI()
        BasicTreeUIの新しいインスタンスを構築します。
    • メソッドの詳細

      • createUI

        public static ComponentUI createUI​(JComponent x)
        BasicTreeUIの新しいインスタンスを構築します。
        パラメータ:
        x - コンポーネント
        戻り値:
        BasicTreeUIの新しいインスタンス
      • getHashColor

        protected Color getHashColor()
        ハッシュの色を返します。
        戻り値:
        ハッシュ・カラー
      • setHashColor

        protected void setHashColor​(Color color)
        ハッシュ・カラーを設定します。
        パラメータ:
        color - ハッシュ・カラー
      • setLeftChildIndent

        public void setLeftChildIndent​(int newAmount)
        左の子インデントを設定します。
        パラメータ:
        newAmount - 左の子インデント
      • getLeftChildIndent

        public int getLeftChildIndent()
        左の子インデントを返します。
        戻り値:
        左の子インデント
      • setRightChildIndent

        public void setRightChildIndent​(int newAmount)
        右の子インデントを設定します。
        パラメータ:
        newAmount - 右の子インデント
      • getRightChildIndent

        public int getRightChildIndent()
        右の子インデントを返します。
        戻り値:
        右の子インデント
      • setExpandedIcon

        public void setExpandedIcon​(Icon newG)
        展開されたアイコンを設定します。
        パラメータ:
        newG - 展開されたアイコン
      • getExpandedIcon

        public Icon getExpandedIcon()
        展開されたアイコンを返します。
        戻り値:
        展開されたアイコン
      • setCollapsedIcon

        public void setCollapsedIcon​(Icon newG)
        折りたたまれたアイコンを設定します。
        パラメータ:
        newG - 折りたたまれたアイコン
      • getCollapsedIcon

        public Icon getCollapsedIcon()
        折りたたまれたアイコンを返します。
        戻り値:
        折りたたまれたアイコン
      • setLargeModel

        protected void setLargeModel​(boolean largeModel)
        必要な場合に、componentListenerを更新します。
        パラメータ:
        largeModel - 新しい価値
      • isLargeModel

        protected boolean isLargeModel()
        大きなモデルが設定されている場合、trueを返します。
        戻り値:
        大型モデルが設定されている場合はtrue
      • setRowHeight

        protected void setRowHeight​(int rowHeight)
        treeStateに転送される、行の高さを設定します。
        パラメータ:
        rowHeight - 行の高さ
      • getRowHeight

        protected int getRowHeight()
        行の高さを返します。
        戻り値:
        行の高さ
      • setCellRenderer

        protected void setCellRenderer​(TreeCellRenderer tcr)
        TreeCellRenderertcrに設定します。 これにより、updateRendererが呼び出されます。
        パラメータ:
        tcr - 新しい価値
      • getCellRenderer

        protected TreeCellRenderer getCellRenderer()
        currentCellRendererを返します。これはツリー・レンダラか、defaultCellRendererです。これはnullではありません。
        戻り値:
        TreeCellRendererのインスタンス
      • setModel

        protected void setModel​(TreeModel model)
        TreeModelを設定します。
        パラメータ:
        model - 新しい価値
      • getModel

        protected TreeModel getModel()
        ツリー・モデルを返します。
        戻り値:
        ツリー・モデル
      • setRootVisible

        protected void setRootVisible​(boolean newValue)
        ルートを可視に設定します。
        パラメータ:
        newValue - 新しい値
      • isRootVisible

        protected boolean isRootVisible()
        ツリー・ルートが表示されている場合はtrueを返します。
        戻り値:
        true、ツリー・ルートが表示されている場合
      • setShowsRootHandles

        protected void setShowsRootHandles​(boolean newValue)
        ノードのハンドルが表示されるかどうかを決めます。
        パラメータ:
        newValue - 新しい値
      • getShowsRootHandles

        protected boolean getShowsRootHandles()
        ルート・ハンドルが表示される場合はtrueを返します。
        戻り値:
        ルート・ハンドルが表示される場合はtrue
      • setCellEditor

        protected void setCellEditor​(TreeCellEditor editor)
        セル・エディタを設定します。
        パラメータ:
        editor - 新しいセル・エディタ
      • getCellEditor

        protected TreeCellEditor getCellEditor()
        TreeCellEditorのインスタンスを返します。
        戻り値:
        TreeCellEditorのインスタンス
      • setEditable

        protected void setEditable​(boolean newValue)
        レシーバが編集を許可するかどうかを設定します。
        パラメータ:
        newValue - 新しい値
      • isEditable

        protected boolean isEditable()
        ツリーが編集可能な場合はtrueを返します。
        戻り値:
        ツリーが編集可能な場合はtrue
      • setSelectionModel

        protected void setSelectionModel​(TreeSelectionModel newLSM)
        選択モデルをリセットします。 適切なリスナーがモデルでインストールされます。
        パラメータ:
        newLSM - 新しい選択モデル
      • getSelectionModel

        protected TreeSelectionModel getSelectionModel()
        ツリー選択モデルを返します。
        戻り値:
        ツリー選択モデル
      • getPathBounds

        public Rectangle getPathBounds​(JTree tree,
                                       TreePath path)
        パスの最後の項目が描画されるラベル部分を囲むRectangleを返します。 パスのコンポーネントのどれかが現在有効な場合は、nullが返されます。
        定義:
        getPathBounds、クラスTreeUI
        パラメータ:
        tree - pathJTree
        path - ノードを識別するTreePath
        戻り値:
        パスの最後のアイテムが描画されるラベル部分を囲むRectangle、パス内のコンポーネントが現在有効な場合はnull
      • getPathForRow

        public TreePath getPathForRow​(JTree tree,
                                      int row)
        渡されたrowのパスを返します。 rowが可視でない場合は、nullが返されます。
        定義:
        getPathForRow、クラスTreeUI
        パラメータ:
        tree - JTreeオブジェクト
        row - 行を指定する整数
        戻り値:
        rowが表示されない場合はrowまたはnullpath
      • getRowForPath

        public int getRowForPath​(JTree tree,
                                 TreePath path)
        pathで識別される最後の項目が可視である行を返します。 path内のどの要素も現在は可視でない場合は、-1を返します。
        定義:
        getRowForPath、クラスTreeUI
        パラメータ:
        tree - pathJTree
        path - 見るTreePathオブジェクト
        戻り値:
        pathの要素のどれかが現在可視でない場合は -1を返します。
      • getRowCount

        public int getRowCount​(JTree tree)
        表示されている行数を返します。
        定義:
        getRowCount、クラスTreeUI
        パラメータ:
        tree - 行数をカウントするJTree
        戻り値:
        表示されている行の数を指定する整数
      • getClosestPathForLocation

        public TreePath getClosestPathForLocation​(JTree tree,
                                                  int x,
                                                  int y)
        x、yにもっとも近いノードへのパスを返します。 現在可視のものがない場合は、nullを返します。そうでない場合は、常に有効なパスを返します。 返されたオブジェクトが正確にx, yにあるかどうかを判定する必要がある場合は、返されたパスの矩形を取得して、x, yと比較するようにしてください。
        定義:
        getClosestPathForLocation、クラスTreeUI
        パラメータ:
        tree - JTreeオブジェクト
        x - 表示領域の左端から水平方向にピクセル数を与える整数。
        y - 表示領域の上端からの垂直距離をピクセル単位で示す整数値(上マージンは除く)
        戻り値:
        現在表示されているものがない場合は、x,yまたはnullに最も近いTreePathノード
      • isEditing

        public boolean isEditing​(JTree tree)
        ツリーが編集中の場合にtrueを返します。 編集中の項目を取得するには、getEditingPath()を使います。
        定義:
        isEditing、クラスTreeUI
        パラメータ:
        tree - JTreeオブジェクト
        戻り値:
        treeが編集中の場合はtrue
      • stopEditing

        public boolean stopEditing​(JTree tree)
        現在の編集セッションを中止します。 ツリーが編集中でない場合は、このメソッドは何も行いません。 エディタが編集セッションの中止を許可した場合は、trueを返します。
        定義:
        stopEditing、クラスTreeUI
        パラメータ:
        tree - JTreeオブジェクト
        戻り値:
        エディタが編集セッションを停止できる場合はtrue
      • cancelEditing

        public void cancelEditing​(JTree tree)
        現在の編集セッションを取り消します。
        定義:
        cancelEditing、クラスTreeUI
        パラメータ:
        tree - JTreeオブジェクト
      • startEditingAtPath

        public void startEditingAtPath​(JTree tree,
                                       TreePath path)
        pathの最後の項目を選択し、その項目の編集を試みます。 CellEditorが選択された項目の編集を許可しない場合、編集は失敗します。
        定義:
        startEditingAtPath、クラスTreeUI
        パラメータ:
        tree - 編集中のJTree
        path - 編集するTreePath
      • getEditingPath

        public TreePath getEditingPath​(JTree tree)
        編集中の要素へのパスを返します。
        定義:
        getEditingPath、クラスTreeUI
        パラメータ:
        tree - パスを返すJTree
        戻り値:
        treeへのパスを含むTreePath
      • prepareForUIInstall

        protected void prepareForUIInstall()
        treeインスタンス変数の設定後、デフォルトおよびリスナーがインストールされる前に呼び出されます。
      • completeUIInstall

        protected void completeUIInstall()
        すべてのデフォルトおよびリスナーがインストールされたあとにinstallUIから呼び出されます。
      • installDefaults

        protected void installDefaults()
        デフォルトのプロパティをインストールします。
      • installListeners

        protected void installListeners()
        リスナーを登録します。
      • installKeyboardActions

        protected void installKeyboardActions()
        キーボード操作を登録します。
      • installComponents

        protected void installComponents()
        レンダラ・ペインである、ツリーのサブコンポーネントをインストールします。
      • createNodeDimensions

        protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
        ツリー内の指定されたノードのサイズを決定できるNodeDimensionsのインスタンスを作成します。
        戻り値:
        NodeDimensionsのインスタンス
      • createPropertyChangeListener

        protected PropertyChangeListener createPropertyChangeListener()
        ツリーの変更に基づいてUIを更新するリスナーを作成します。
        戻り値:
        PropertyChangeListenerのインスタンス
      • createMouseListener

        protected MouseListener createMouseListener()
        マウス・イベントに基づいて選択を更新するリスナーを作成します。
        戻り値:
        MouseListenerのインスタンス
      • createFocusListener

        protected FocusListener createFocusListener()
        フォーカスを喪失または取得したときに表示を更新するリスナーを作成します。
        戻り値:
        FocusListenerのインスタンス
      • createKeyListener

        protected KeyListener createKeyListener()
        ツリーからキー・イベントを取得するリスナーを作成します。
        戻り値:
        KeyListenerのインスタンス
      • createSelectionModelPropertyChangeListener

        protected PropertyChangeListener createSelectionModelPropertyChangeListener()
        選択モデルからプロパティ変更イベントを取得するリスナーを作成します。
        戻り値:
        PropertyChangeListenerのインスタンス
      • createTreeSelectionListener

        protected TreeSelectionListener createTreeSelectionListener()
        選択変更メソッドに基づいて表示を更新するリスナーを作成します。
        戻り値:
        TreeSelectionListenerのインスタンス
      • createCellEditorListener

        protected CellEditorListener createCellEditorListener()
        現在のエディタからのイベントを処理するリスナーを作成します。
        戻り値:
        CellEditorListenerのインスタンス
      • createComponentListener

        protected ComponentListener createComponentListener()
        新しいComponentHandlerを作成し、それを返します。 これは、大きなモデルで、コンポーネントが移動したときにvalidCachedPreferredSizeを無効にするために使用されます。
        戻り値:
        ComponentListenerのインスタンス
      • createTreeExpansionListener

        protected TreeExpansionListener createTreeExpansionListener()
        ノードの展開状態が変更されたときにツリーの状態を更新するオブジェクトを作成し、それを返します。
        戻り値:
        TreeExpansionListenerのインスタンス
      • createLayoutCache

        protected AbstractLayoutCache createLayoutCache()
        何が展開されているかおよびノードのサイズを管理するオブジェクトを作成します。
        戻り値:
        拡張されたものを管理するオブジェクト
      • createCellRendererPane

        protected CellRendererPane createCellRendererPane()
        レンダラ・コンポーネントが配置されているレンダラ・ペインを返します。
        戻り値:
        CellRendererPaneのインスタンス
      • createDefaultCellEditor

        protected TreeCellEditor createDefaultCellEditor()
        デフォルトのセル・エディタを作成します。
        戻り値:
        デフォルトのセル・エディタ
      • createDefaultCellRenderer

        protected TreeCellRenderer createDefaultCellRenderer()
        各ノードをスタンプするために使われるデフォルトのセル・レンダラを返します。
        戻り値:
        TreeCellRendererのインスタンス
      • createTreeModelListener

        protected TreeModelListener createTreeModelListener()
        モデルが変更されたときにツリーを更新できるリスナーを返します。
        戻り値:
        TreeModelListenerのインスタンス。
      • prepareForUIUninstall

        protected void prepareForUIUninstall()
        UIをアンストールする前に呼び出されます。
      • completeUIUninstall

        protected void completeUIUninstall()
        UIをアンインストールします。
      • uninstallDefaults

        protected void uninstallDefaults()
        既定のプロパティをアンインストールします。
      • uninstallListeners

        protected void uninstallListeners()
        リスナーを登録解除します。
      • uninstallKeyboardActions

        protected void uninstallKeyboardActions()
        キーボード操作の登録を解除します。
      • uninstallComponents

        protected void uninstallComponents()
        レンダラ・ペインをアンインストールします。
      • getBaseline

        public int getBaseline​(JComponent c,
                               int width,
                               int height)
        ベースラインを返します。
        オーバーライド:
        getBaseline、クラスComponentUI
        パラメータ:
        c - ベースラインが要求されるJComponent
        width - ベースラインを取得する幅
        height - ベースラインを取得する高さ
        戻り値:
        ベースラインまたは0より小さい値(適切なベースラインがないことを示す)
        例外:
        NullPointerException - cnullである場合
        IllegalArgumentException - 幅または高さが0より小さい場合
        導入されたバージョン:
        1.6
        関連項目:
        JComponent.getBaseline(int, int)
      • getBaselineResizeBehavior

        public Component.BaselineResizeBehavior getBaselineResizeBehavior​(JComponent c)
        サイズの変化に合わせてコンポーネントのベースラインがどのように変化するかを示す列挙を返します。
        オーバーライド:
        getBaselineResizeBehavior、クラスComponentUI
        パラメータ:
        c - ベースラインのサイズ変更の動作を返すJComponent
        戻り値:
        コンポーネント・サイズの変化に合わせてベースラインがどのように変化するかを示す列挙
        例外:
        NullPointerException - cnullである場合
        導入されたバージョン:
        1.6
        関連項目:
        JComponent.getBaseline(int, int)
      • isDropLine

        protected boolean isDropLine​(JTree.DropLocation loc)
        DropLocationをノード間のラインによって示すかどうかを通知します。 これはjavax.swing.DropMode.INSERTおよびjavax.swing.DropMode.ON_OR_INSERTドロップ・モードで使用されます。
        パラメータ:
        loc - DropLocation
        戻り値:
        ドロップ位置をラインとして示す場合はtrue
        導入されたバージョン:
        1.7
      • paintDropLine

        protected void paintDropLine​(Graphics g)
        ドロップ・ラインをペイントします。
        パラメータ:
        g - 描画するGraphicsオブジェクト
        導入されたバージョン:
        1.7
      • getDropLineRect

        protected Rectangle getDropLineRect​(JTree.DropLocation loc)
        ドロップ・ラインのアンバウンディング・ボックスを返します。
        パラメータ:
        loc - DropLocation
        戻り値:
        ドロップ・ラインのバウンディング・ボックス
        導入されたバージョン:
        1.7
      • paintHorizontalPartOfLeg

        protected void paintHorizontalPartOfLeg​(Graphics g,
                                                Rectangle clipBounds,
                                                Insets insets,
                                                Rectangle bounds,
                                                TreePath path,
                                                int row,
                                                boolean isExpanded,
                                                boolean hasBeenExpanded,
                                                boolean isLeaf)
        脚の水平部分をペイントします。 レシーバは、clipBoundsinsetsを変更しないでください。

        ノート: ルートが可視でない場合、parentRowは -1になることがあります。

        パラメータ:
        g - グラフィックス・コンテキスト
        clipBounds - クリップされた矩形
        insets - insets
        bounds - 外接する矩形
        path - ツリー・パス
        row - 行
        isExpanded - パスが展開されている場合はtrue
        hasBeenExpanded - パスが展開されている場合はtrue
        isLeaf - パスがリーフの場合はtrue
      • paintVerticalPartOfLeg

        protected void paintVerticalPartOfLeg​(Graphics g,
                                              Rectangle clipBounds,
                                              Insets insets,
                                              TreePath path)
        脚の垂直部分をペイントします。 レシーバは、clipBoundsinsetsを変更しないでください。
        パラメータ:
        g - グラフィックス・コンテキスト
        clipBounds - クリップされた矩形
        insets - insets
        path - ツリー・パス
      • paintExpandControl

        protected void paintExpandControl​(Graphics g,
                                          Rectangle clipBounds,
                                          Insets insets,
                                          Rectangle bounds,
                                          TreePath path,
                                          int row,
                                          boolean isExpanded,
                                          boolean hasBeenExpanded,
                                          boolean isLeaf)
        行の展開(切り替え)部分をペイントします。 レシーバは、clipBoundsinsetsを変更しないでください。
        パラメータ:
        g - グラフィックス・コンテキスト
        clipBounds - クリップされた矩形
        insets - insets
        bounds - 外接する矩形
        path - ツリー・パス
        row - 行
        isExpanded - パスが展開されている場合はtrue
        hasBeenExpanded - パスが展開されている場合はtrue
        isLeaf - 行がリーフの場合はtrue
      • paintRow

        protected void paintRow​(Graphics g,
                                Rectangle clipBounds,
                                Insets insets,
                                Rectangle bounds,
                                TreePath path,
                                int row,
                                boolean isExpanded,
                                boolean hasBeenExpanded,
                                boolean isLeaf)
        行のレンダラ部分をペイントします。 レシーバは、clipBoundsinsetsを変更しないでください。
        パラメータ:
        g - グラフィックス・コンテキスト
        clipBounds - クリップされた矩形
        insets - insets
        bounds - 外接する矩形
        path - ツリー・パス
        row - 行
        isExpanded - パスが展開されている場合はtrue
        hasBeenExpanded - パスが展開されている場合はtrue
        isLeaf - パスがリーフの場合はtrue
      • shouldPaintExpandControl

        protected boolean shouldPaintExpandControl​(TreePath path,
                                                   int row,
                                                   boolean isExpanded,
                                                   boolean hasBeenExpanded,
                                                   boolean isLeaf)
        (toggle)コントロールを展開して指定された行に描画する必要がある場合は、trueを返します。
        パラメータ:
        path - ツリー・パス
        row - 行
        isExpanded - パスが展開されている場合はtrue
        hasBeenExpanded - パスが展開されている場合はtrue
        isLeaf - 行がリーフの場合はtrue
        戻り値:
        指定された行の(toggle)コントロールを展開する必要がある場合はtrue
      • paintVerticalLine

        protected void paintVerticalLine​(Graphics g,
                                         JComponent c,
                                         int x,
                                         int top,
                                         int bottom)
        垂直線をペイントします。
        パラメータ:
        g - グラフィックス・コンテキスト
        c - コンポーネント
        x - X座標
        top - Y1座標
        bottom - Y2座標
      • paintHorizontalLine

        protected void paintHorizontalLine​(Graphics g,
                                           JComponent c,
                                           int y,
                                           int left,
                                           int right)
        水平線をペイントします。
        パラメータ:
        g - グラフィックス・コンテキスト
        c - コンポーネント
        y - Y座標
        left - X1座標
        right - X2座標
      • getVerticalLegBuffer

        protected int getVerticalLegBuffer()
        ノード間の脚の垂直要素は、デフォルトでは親ノードの下端から始まります。 このメソッドは、脚がそれより下で始まるようにします。
        戻り値:
        垂直バッファ
      • getHorizontalLegBuffer

        protected int getHorizontalLegBuffer()
        ノード間の脚の水平要素は、デフォルトでは子ノードの左側の右で始まります。 このメソッドは、脚がそれより前で終わるようにします。
        戻り値:
        水平バッファ
      • drawCentered

        protected void drawCentered​(Component c,
                                    Graphics graphics,
                                    Icon icon,
                                    int x,
                                    int y)
        (x,y)を中心とするiconを描画します。
        パラメータ:
        c - コンポーネント
        graphics - グラフィックス・コンテキスト
        icon - アイコン
        x - X座標
        y - Y座標
      • drawDashedHorizontalLine

        protected void drawDashedHorizontalLine​(Graphics g,
                                                int y,
                                                int x1,
                                                int x2)
        水平の破線を描画します。 x1 <= x2とします。 x1x2より大きい場合、このメソッドは何も描画しません。
        パラメータ:
        g - Graphicsのインスタンス
        y - Y座標
        x1 - X1座標
        x2 - X2座標
      • drawDashedVerticalLine

        protected void drawDashedVerticalLine​(Graphics g,
                                              int x,
                                              int y1,
                                              int y2)
        垂直の破線を描画します。 y1 <= y2とします。 y1y2より大きい場合、このメソッドは何も描画しません。
        パラメータ:
        g - Graphicsのインスタンス
        x - X座標
        y1 - Y1座標
        y2 - Y2座標
      • getRowX

        protected int getRowX​(int row,
                              int depth)
        x軸に沿って特定の行をレンダリングする位置を返します。 戻り値には、JTreeで指定されたイン・セット値は一切含まれません。 このメソッドでは、行または深さの有効性は確認しないため、行または深さがツリーのそれと一致しない場合でも、正しいと見なされて、例外をスローしません。
        パラメータ:
        row - x位置を返す行
        depth - 行の深さ
        戻り値:
        指定された行をインデントする量。
        導入されたバージョン:
        1.5
      • updateLayoutCacheExpandedNodes

        protected void updateLayoutCacheExpandedNodes()
        JTreeで展開されているすべてのノードをLayoutCacheで展開します。 これにより、ルート・パスでupdateExpandedDescendantsが呼び出されます。
      • updateExpandedDescendants

        protected void updateExpandedDescendants​(TreePath path)
        ツリーから展開されている子孫を取得し、ツリー状態に転送することで、pathのすべての子孫の展開状態を更新します。
        パラメータ:
        path - ツリー・パス
      • getLastChildPath

        protected TreePath getLastChildPath​(TreePath parent)
        parentの最後の子のパスを返します。
        パラメータ:
        parent - ツリー・パス
        戻り値:
        parentの最後の子へのパス
      • updateDepthOffset

        protected void updateDepthOffset()
        各深さをどのくらいオフセットするべきかを更新します。
      • updateCellEditor

        protected void updateCellEditor()
        JTreeが編集できるかどうかに応じてcellEditorを更新します。 ツリーが編集できるが、cellEditorがない場合、基本的なセル・エディタが使われます。
      • updateRenderer

        protected void updateRenderer()
        レンダラが変更されたときにツリーからメッセージとして送られます。
      • configureLayoutCache

        protected void configureLayoutCache()
        Look & Feelを提供しているツリーに基づいてTreeStateのインスタンスをリセットします。
      • updateSize

        protected void updateSize()
        キャッシュされているサイズを無効とマークし、treeDidChangeでメッセージをツリーに送ります。
      • updateCachedPreferredSize

        protected void updateCachedPreferredSize()
        getPreferredSize()から返されるpreferredSizeインスタンス変数を更新します。

        左から右方向の場合、サイズは現在のAbstractLayoutCacheから決定されます。 右から左方向の場合、推奨サイズは幅から最小のx位置を引いた値になります。

      • pathWasExpanded

        protected void pathWasExpanded​(TreePath path)
        VisibleTreeNodeから展開された後にメッセージが送られます。
        パラメータ:
        path - ツリー・パス
      • pathWasCollapsed

        protected void pathWasCollapsed​(TreePath path)
        VisibleTreeNodeから折りたたまれた後にメッセージが送られます。
        パラメータ:
        path - ツリー・パス
      • ensureRowsAreVisible

        protected void ensureRowsAreVisible​(int beginRow,
                                            int endRow)
        beginRowendRowによって識別される行が確実に表示されるようにします。
        パラメータ:
        beginRow - 開始行
        endRow - 最後の行
      • setPreferredMinSize

        public void setPreferredMinSize​(Dimension newSize)
        推奨される最小サイズを設定します。
        パラメータ:
        newSize - 新しい優先サイズ
      • getPreferredMinSize

        public Dimension getPreferredMinSize()
        推奨される最小サイズを返します。
        戻り値:
        最小優先サイズ
      • getPreferredSize

        public Dimension getPreferredSize​(JComponent c,
                                          boolean checkConsistency)
        cでツリーを表すための推奨サイズを返します。 checkConsistencytrueの場合、checkConsistencyが最初に送信されます。
        パラメータ:
        c - コンポーネント
        checkConsistency - trueの整合性がチェックされている場合
        戻り値:
        コンポーネント内のツリーを表すのに優先されるサイズ
      • getMaximumSize

        public Dimension getMaximumSize​(JComponent c)
        このコンポーネントの最大サイズを返します。インスタンスが現在JTreeにある場合は推奨サイズ、そうでない場合は0, 0です。
        オーバーライド:
        getMaximumSize、クラスComponentUI
        パラメータ:
        c - 最大サイズが照会されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがある
        戻り値:
        Dimensionオブジェクトまたはnull
        関連項目:
        JComponent.getMaximumSize(), LayoutManager2.maximumLayoutSize(java.awt.Container)
      • completeEditing

        protected void completeEditing()
        編集中セッションを中止するメッセージを送ります。 レシーバがLook & Feelを提供しているUIがgetInvokesStopCellEditingからtrueを返す場合、stopCellEditingが現在のエディタで呼び出されます。 次にcompleteEditingがfalseまたはtrueでメッセージとして送られます。falseは、中途の編集を取り消します。
      • completeEditing

        protected void completeEditing​(boolean messageStop,
                                       boolean messageCancel,
                                       boolean messageTree)
        編集中セッションを中止します。 messageStoptrueの場合、stopEditingでエディタにメッセージが送信されます。messageCanceltrueであれば、エディタはcancelEditingでメッセージされます。 messageTreetrueの場合、treeModelvalueForPathChangedでメッセージされます。
        パラメータ:
        messageStop - 編集を中止するメッセージ
        messageCancel - 編集を取消するメッセージ
        messageTree - ツリーへのメッセージ
      • startEditing

        protected boolean startEditing​(TreePath path,
                                       MouseEvent event)
        cellEditorがあり、shouldSelectCelltrueを返した場合、ノードの編集を開始します。

        このメソッドは、パスが有効であり、可視であると見なします。

        パラメータ:
        path - ツリー・パス
        event - マウス・イベント
        戻り値:
        true編集が成功した場合
      • checkForClickInExpandControl

        protected void checkForClickInExpandControl​(TreePath path,
                                                    int mouseX,
                                                    int mouseY)
        mouseXおよびmouseYrowの展開または折りたたみの領域にある場合、このメソッドは行の展開状態を切り替えます。
        パラメータ:
        path - ツリー・パス
        mouseX - X座標
        mouseY - Y座標
      • isLocationInExpandControl

        protected boolean isLocationInExpandControl​(TreePath path,
                                                    int mouseX,
                                                    int mouseY)
        mouseXmouseYが、ノードを展開/折りたたむために使用される行の領域に入る場合はtrueを返し、rowのノードはリーフを表しません。
        パラメータ:
        path - ツリー・パス
        mouseX - X座標
        mouseY - Y座標
        戻り値:
        trueマウス・カーソルが、ノードを展開/折りたたむために使用される行の領域にあり、ノードがリーフでない場合。
      • handleExpandControlClick

        protected void handleExpandControlClick​(TreePath path,
                                                int mouseX,
                                                int mouseY)
        ユーザーが特定の行をクリックするとメッセージが送られ、toggleExpandStateが呼び出されます。
        パラメータ:
        path - ツリー・パス
        mouseX - X座標
        mouseY - Y座標
      • toggleExpandState

        protected void toggleExpandState​(TreePath path)
        パスが展開されてない場合は展開し、行が展開されている場合は折りたたみます。 パスを展開し、展開時にJTreeがスクロールすると、ensureRowsAreVisibleが呼び出され、できるだけ多くの子をスクロールして(パスの最後の子孫にスクロールしようとします。)として表示します。
        パラメータ:
        path - ツリー・パス
      • isToggleSelectionEvent

        protected boolean isToggleSelectionEvent​(MouseEvent event)
        trueを返すと、ノード上のマウス・イベントは、マウスの下の行のみの選択を切り替える必要があることを示します。
        パラメータ:
        event - マウス・イベント
        戻り値:
        trueノード上のマウス・イベントで選択項目を切り替える必要がある場合
      • isMultiSelectEvent

        protected boolean isMultiSelectEvent​(MouseEvent event)
        trueを返すと、ノード上のマウス・イベントがアンカー・ポイントから選択されることを意味します。
        パラメータ:
        event - マウス・イベント
        戻り値:
        ノード上のマウス・イベントがアンカー・ポイントから選択する必要がある場合はtrue
      • isToggleEvent

        protected boolean isToggleEvent​(MouseEvent event)
        trueを返すと、マウスの下の行がイベントに基づいてトグルされるべきであることが示されます。 これはcheckForClickInExpandControlの後に呼び出され、ロケーションがexpand (toggle)コントロールにないことを意味します。
        パラメータ:
        event - マウス・イベント
        戻り値:
        trueマウスの下の行をトグルする必要がある場合
      • selectPathForEvent

        protected void selectPathForEvent​(TreePath path,
                                          MouseEvent event)
        特定の行のMouseEventに基づいて選択を更新するようにメッセージを送りました。 イベントが選択切替えイベントの場合、行が選択または選択解除されます。 イベントが複数選択イベントを示す場合、選択はアンカー・ポイントから更新されます。 そうでない場合は行が選択され、イベントが切替えイベントを示す場合は行の展開または折りたたみが行われます。
        パラメータ:
        path - 選択されたパス
        event - マウス・イベント
      • isLeaf

        protected boolean isLeaf​(int row)
        rowのノードがリーフの場合、trueを返します。
        パラメータ:
        row - 行
        戻り値:
        rowのノードがリーフの場合はtrue
      • updateLeadSelectionRow

        protected void updateLeadSelectionRow()
        選択のリード行を更新します。
        導入されたバージョン:
        1.7
      • getLeadSelectionRow

        protected int getLeadSelectionRow()
        選択のリード行を返します。
        戻り値:
        選択リード行
        導入されたバージョン:
        1.7