クラスMetalTreeUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TreeUI
javax.swing.plaf.basic.BasicTreeUI
javax.swing.plaf.metal.MetalTreeUI
public class MetalTreeUI extends BasicTreeUI
TreeUIのMetal Look & Feel実装です。
MetalTreeUIがノード間の間隔と輪郭を可視的に描画する方法を構成できるようにします。 次のヒントをサポートします。
| ヒント | 説明 |
|---|---|
| 斜線 | 子と親を結ぶ線が描かれる。 ルート・ノードの処理については、JTree.setRootVisible(boolean)およびJTree.setShowsRootHandles(boolean)を参照。
|
| Horizontal | ルート・ノードの子を区分する水平線が描かれる |
| なし | ノード間に視覚的な指示を与える線を描かない |
通常、JTreeからTreeUIを取得してMetalTreeUIのインスタンスにキャストするのは実際的な方法ではないので、クライアント・プロパティJTree.lineStyleを使用してこのプロパティを有効にします。 たとえば、Horizontalスタイルに切り替えるには、tree.putClientProperty("JTree.lineStyle", "Horizontal");を実行します。
デフォルトはAngledです。
-
ネストされたクラスのサマリー
クラスBasicTreeUIで宣言されたネストされたクラス/インタフェース
BasicTreeUI.CellEditorHandler, BasicTreeUI.ComponentHandler, BasicTreeUI.FocusHandler, BasicTreeUI.KeyHandler, BasicTreeUI.MouseHandler, BasicTreeUI.MouseInputHandler, BasicTreeUI.NodeDimensionsHandler, BasicTreeUI.PropertyChangeHandler, BasicTreeUI.SelectionModelPropertyChangeHandler, BasicTreeUI.TreeCancelEditingAction, BasicTreeUI.TreeExpansionHandler, BasicTreeUI.TreeHomeAction, BasicTreeUI.TreeIncrementAction, BasicTreeUI.TreeModelHandler, BasicTreeUI.TreePageAction, BasicTreeUI.TreeSelectionHandler, BasicTreeUI.TreeToggleAction, BasicTreeUI.TreeTraverseAction修飾子と型クラス説明classセル編集イベントを取得し、それに応じてツリーを更新するリスナーです。classスクロール時に推奨サイズを更新します(必要に応じて)。classフォーカスを失ったとき、または取得したときに、リード選択行をペイントし直します。classこれは、複数のキー押下イベントを取得して適切にイベントを生成するために使用されます。classTreeMouseListenerはマウス・イベントに基づいて選択を更新します。classMouseInputHandlerは、マウスが放されて構築済みの送信先に送られるまで、すべてのマウス・イベント(マウス・モーション・イベントなど)を渡します。classノードのサイズを取得するクラス、メソッドはBasicTreeUIメソッドに転送されます。classツリーのPropertyChangeListenerです。classTreeSelectionModelのリスナー、モデルのプロパティが変更された場合に行選択をリセットします。classアクションが実行されたときにcancelEditingを呼び出すActionListenerです。classノードの展開または折りたたみに応じてTreeStateを更新します。classTreeHomeActionは、終了またはホーム・アクションを処理するために使用されます。classTreeIncrementActionは、上下のアクションを処理するために使われます。classすべてのTreeModelイベントをTreeStateに転送します。classTreePageActionは、ページ・アップとページ・ダウンのイベントを処理します。class選択モデルの変更を待機し、それに応じて表示を更新します。class最初に選択された行で、展開状態が切り替えられます。classTreeTraverseActionは、左または右キーのために使用されるアクションです。 -
フィールドのサマリー
クラスで宣言されたフィールド BasicTreeUI
cellEditor, collapsedIcon, createdCellEditor, createdRenderer, currentCellRenderer, depthOffset, drawingCache, editingComponent, editingPath, editingRow, editorHasDifferentSize, expandedIcon, largeModel, lastSelectedRow, leftChildIndent, nodeDimensions, preferredMinSize, preferredSize, rendererPane, rightChildIndent, stopEditingInCompleteEditing, totalChildIndent, tree, treeModel, treeSelectionModel, treeState, validCachedPreferredSize修飾子と型フィールド説明protected TreeCellEditorツリーのエディタです。protected Icon折りたたまれたアイコン。protected boolean現在ツリーにあるエディタがこのインスタンスによって作成された場合にtrueに設定されます。protected boolean現在ツリーにあるレンダラがこのインスタンスによって作成された場合にtrueに設定されます。protected TreeCellRenderer実際のセルの描画を行うために使われているレンダラです。protected intx位置を正確に計算するための深さのオフセットの量です。垂直線の描画を最小化するために使われます。protected Componentこれは編集時に、実際の編集を行うComponentになります。protected TreePath編集中のパスです。protected int編集中の行です。protected booleanエディタのサイズがレンダラと異なる場合にtrueに設定されます。protected Icon拡張アイコン。protected booleanlargeModelの最適化を行なっている場合はtrueです。protected int最後に選択された行のインデックスです。protected int左マージンと垂直の破線が描画される位置の間の距離です。protected AbstractLayoutCache.NodeDimensionsTreeStateにノードに必要なサイズを指示します。protected Dimension推奨される最小サイズです。protected Dimensionすべてのノードを完全に表示するために必要なサイズです。protected CellRendererPaneTreeCellRendererをペイントするために使われます。protected intセルの内容が描画される位置を決定するためにleftChildIndentに加算される距離です。protected boolean編集時に、shouldSelectCell()がtrueを返した場合にfalseに設定されます。これは、completeEditingで使用され、ノードが編集前に選択されなければならないことを意味しています。protected intインデントされる総距離です。protected JTree描画先のコンポーネントです。protected TreeModel何を表示するかを決定するために使われます。protected TreeSelectionModel選択を維持するモデルです。protected AbstractLayoutCacheサイズ変更や展開されているかどうかを処理するオブジェクトです。protected booleanpreferredSizeが有効かどうかを示します。 -
コンストラクタのサマリー
コンストラクタ -
メソッドのサマリー
修飾子と型メソッド説明static ComponentUIMetalTreeUIを構築します。protected voiddecodeLineStyle(Object lineStyleFlag) クライアント・プロパティに渡された文字列と内部表現の間の変換(現在およびint)protected booleanisLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY) X座標mouseXおよびY座標mouseYを持つポイントが拡張コントロールにある場合、trueを返します。protected void水平セパレータをペイントします。クラスで宣言されたメソッド BasicTreeUI
cancelEditing, checkForClickInExpandControl, completeEditing, completeEditing, completeUIInstall, completeUIUninstall, configureLayoutCache, createCellEditorListener, createCellRendererPane, createComponentListener, createDefaultCellEditor, createDefaultCellRenderer, createFocusListener, createKeyListener, createLayoutCache, createMouseListener, createNodeDimensions, createPropertyChangeListener, createSelectionModelPropertyChangeListener, createTreeExpansionListener, createTreeModelListener, createTreeSelectionListener, drawCentered, drawDashedHorizontalLine, drawDashedVerticalLine, ensureRowsAreVisible, getBaseline, getBaselineResizeBehavior, getCellEditor, getCellRenderer, getClosestPathForLocation, getCollapsedIcon, getDropLineRect, getEditingPath, getExpandedIcon, getHashColor, getHorizontalLegBuffer, getLastChildPath, getLeadSelectionRow, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathBounds, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getRowX, getSelectionModel, getShowsRootHandles, getVerticalLegBuffer, handleExpandControlClick, installComponents, installDefaults, installKeyboardActions, installListeners, isDropLine, isEditable, isEditing, isLargeModel, isLeaf, isLocationInExpandControl, isMultiSelectEvent, isRootVisible, isToggleEvent, isToggleSelectionEvent, paintDropLine, paintExpandControl, paintHorizontalLine, paintHorizontalPartOfLeg, paintRow, paintVerticalLine, paintVerticalPartOfLeg, pathWasCollapsed, pathWasExpanded, prepareForUIInstall, prepareForUIUninstall, selectPathForEvent, setCellEditor, setCellRenderer, setCollapsedIcon, setEditable, setExpandedIcon, setHashColor, setLargeModel, setLeftChildIndent, setModel, setPreferredMinSize, setRightChildIndent, setRootVisible, setRowHeight, setSelectionModel, setShowsRootHandles, shouldPaintExpandControl, startEditing, startEditingAtPath, stopEditing, toggleExpandState, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, updateCachedPreferredSize, updateCellEditor, updateDepthOffset, updateExpandedDescendants, updateLayoutCacheExpandedNodes, updateLeadSelectionRow, updateRenderer, updateSize修飾子と型メソッド説明voidcancelEditing(JTree tree) 現在の編集セッションを取り消します。protected voidcheckForClickInExpandControl(TreePath path, int mouseX, int mouseY) mouseXおよびmouseYがrowの展開または折りたたみの領域にある場合、このメソッドは行の展開状態を切り替えます。protected void編集中セッションを中止するメッセージを送ります。protected voidcompleteEditing(boolean messageStop, boolean messageCancel, boolean messageTree) 編集中セッションを中止します。protected voidすべてのデフォルトおよびリスナーがインストールされたあとにinstallUIから呼び出されます。protected voidUIをアンインストールします。protected voidLook & Feelを提供しているツリーに基づいてTreeStateのインスタンスをリセットします。protected CellEditorListener現在のエディタからのイベントを処理するリスナーを作成します。protected CellRendererPaneレンダラ・コンポーネントが配置されているレンダラ・ペインを返します。protected ComponentListener新しいComponentHandlerを作成し、それを返します。protected TreeCellEditorデフォルトのセル・エディタを作成します。protected TreeCellRenderer各ノードをスタンプするために使われるデフォルトのセル・レンダラを返します。protected FocusListenerフォーカスを喪失または取得したときに表示を更新するリスナーを作成します。protected KeyListenerツリーからキー・イベントを取得するリスナーを作成します。protected AbstractLayoutCache何が展開されているかおよびノードのサイズを管理するオブジェクトを作成します。protected MouseListenerマウス・イベントに基づいて選択を更新するリスナーを作成します。protected AbstractLayoutCache.NodeDimensionsツリー内の特定のノードのサイズを決定できるNodeDimensionsのインスタンスを作成します。protected PropertyChangeListenerツリーの変更に基づいてUIを更新するリスナーを作成します。protected PropertyChangeListener選択モデルからプロパティ変更イベントを取得するリスナーを作成します。protected TreeExpansionListenerノードの展開状態が変更されたときにツリーの状態を更新するオブジェクトを作成し、それを返します。protected TreeModelListenerモデルが変更されたときにツリーを更新できるリスナーを返します。protected TreeSelectionListener選択変更メソッドに基づいて表示を更新するリスナーを作成します。protected voiddrawCentered(Component c, Graphics graphics, Icon icon, int x, int y) (x,y)を中心とするiconを描画します。protected voiddrawDashedHorizontalLine(Graphics g, int y, int x1, int x2) 水平破線を描画します。protected voiddrawDashedVerticalLine(Graphics g, int x, int y1, int y2) 垂直破線を描画します。protected voidensureRowsAreVisible(int beginRow, int endRow) beginRowからendRowで識別される行が表示されることを確認します。intgetBaseline(JComponent c, int width, int height) ベースラインを返します。サイズの変化に合わせてコンポーネントのベースラインがどのように変化するかを示す列挙を返します。protected TreeCellEditor描画されたツリー・コンポーネントのエントリの編集に使用されるエディタを返します。ツリーを編集できない場合はnullを返します。protected TreeCellRenderer各セルをレンダリングするTreeCellRendererの現在のインスタンスを返します。getClosestPathForLocation(JTree tree, int x, int y) x、yにもっとも近いノードへのパスを返します。折りたたまれたアイコンを返します。protected Rectangleドロップ・ラインのアンバウンディング・ボックスを返します。getEditingPath(JTree tree) 編集中の要素へのパスを返します。展開されたアイコンを返します。protected Colorハッシュの色を返します。protected intノード間の脚の水平要素は、デフォルトでは子ノードの左側の右で始まります。protected TreePathgetLastChildPath(TreePath parent) parentの最後の子のパスを返します。protected int選択のリード行を返します。int左の子インデントを返します。このコンポーネントの最大サイズを返します。インスタンスが現在JTreeにある場合は推奨サイズ、そうでない場合は0, 0です。このコンポーネントの最小サイズを返します。protected TreeModelgetModel()ツリー・モデルを返します。getPathBounds(JTree tree, TreePath path) パスの最後の項目が描画されるラベル部分を囲むRectangleを返します。getPathForRow(JTree tree, int row) 渡されたrowのパスを返します。推奨される最小サイズを返します。ツリーを正しく表示するための優先サイズを返します。これは、getPreferredSize(c, true)のカバー・メソッドです。getPreferredSize(JComponent c, boolean checkConsistency) cでツリーを表すための推奨サイズを返します。int適切な子インデントを返します。intgetRowCount(JTree tree) 表示されている行数を返します。intgetRowForPath(JTree tree, TreePath path) pathで識別される最後の項目が可視である行を返します。protected int描画されたツリー・コンポーネントの各行の高さを返します。protected intgetRowX(int row, int depth) x軸に沿って特定の行をレンダリングする位置を返します。protected TreeSelectionModel選択のモデルであるTreeSelectionModelの現在のインスタンスを返します。protected booleanルート・ハンドルを表示する場合は、trueを返します。protected intノード間の脚の垂直要素は、デフォルトでは親ノードの下端から始まります。protected voidhandleExpandControlClick(TreePath path, int mouseX, int mouseY) ユーザーが特定の行をクリックすると、toggleExpandStateが呼び出されます。protected voidレンダラ・ペインであるツリーのサブコンポーネントをインストールします。protected voidデフォルトのプロパティをインストールします。protected voidキーボード操作を登録します。protected voidリスナーを登録します。protected booleanDropLocationをノード間のラインによって示すかどうかを通知します。protected boolean描画されたツリー・コンポーネントの編集を有効にするかどうかを返します。booleanツリーが編集中の場合にtrueを返します。protected booleanラージ・モデルが設定されている場合は、trueを返します。protected booleanisLeaf(int row) rowのノードがリーフの場合、trueを返します。protected booleanisLocationInExpandControl(TreePath path, int mouseX, int mouseY) mouseXおよびmouseYがノードの展開/縮小に使用される行の領域にあり、rowのノードがリーフを表していない場合は、trueを返します。protected booleanisMultiSelectEvent(MouseEvent event) trueを返すと、ノード上のマウス・イベントがアンカー・ポイントから選択されることを示します。protected boolean描画されたツリー・コンポーネントのルート・ノードを表示するかどうかを返します。protected booleanisToggleEvent(MouseEvent event) trueを返すことは、イベントに基づいてマウスの下の行を切り替える必要があることを示します。protected booleanisToggleSelectionEvent(MouseEvent event) trueを返すと、ノード上のマウス・イベントによって、マウスの下にある行の選択のみが切り替わります。protected voidドロップ・ラインをペイントします。protected voidpaintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) 行の展開(切り替え)部分をペイントします。protected voidpaintHorizontalLine(Graphics g, JComponent c, int y, int left, int right) 水平線をペイントします。protected voidpaintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) 脚の水平部分をペイントします。protected voidpaintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) 行のレンダラ部分をペイントします。protected voidpaintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom) 垂直線をペイントします。protected voidpaintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path) 脚の垂直部分をペイントします。protected voidpathWasCollapsed(TreePath path) VisibleTreeNodeが縮小された後にメッセージを送信します。protected voidpathWasExpanded(TreePath path) VisibleTreeNodeが展開された後に、メッセージを送信します。protected voidtreeインスタンス変数の設定後、デフォルトおよびリスナーがインストールされる前に呼び出されます。protected voidUIのアンインストール前に起動されます。protected voidselectPathForEvent(TreePath path, MouseEvent event) 特定の行に対するMouseEventに基づいて選択を更新するためにメッセージ化されます。protected voidsetCellEditor(TreeCellEditor editor) セル・エディタを設定します。protected voidTreeCellRendererをtcrに設定します。voidsetCollapsedIcon(Icon newG) 折りたたまれたアイコンを設定します。protected voidsetEditable(boolean newValue) レシーバが編集を許可するかどうかを設定します。voidsetExpandedIcon(Icon newG) 展開アイコンを設定します。protected voidsetHashColor(Color color) ハッシュの色を設定します。protected voidsetLargeModel(boolean largeModel) largeModelを設定します。voidsetLeftChildIndent(int newAmount) 左の子のインデントを設定します。protected voidTreeModelを設定します。voidsetPreferredMinSize(Dimension newSize) 推奨される最小サイズを設定します。voidsetRightChildIndent(int newAmount) 適切な子インデントを設定します。protected voidsetRootVisible(boolean newValue) ルートを可視に設定します。protected voidsetRowHeight(int rowHeight) treeStateに転送される、行の高さを設定します。protected voidsetSelectionModel(TreeSelectionModel newLSM) 選択モデルをリセットします。protected voidsetShowsRootHandles(boolean newValue) ノードのハンドルが表示されるかどうかを決めます。protected booleanshouldPaintExpandControl(TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) 指定した行に対して展開(toggle)コントロールを描画する必要がある場合、trueを返します。protected booleanstartEditing(TreePath path, MouseEvent event) cellEditorがあり、shouldSelectCellがtrueを返した場合、ノードの編集を開始します。voidstartEditingAtPath(JTree tree, TreePath path) pathの最後の項目を選択し、その項目の編集を試みます。booleanstopEditing(JTree tree) 現在の編集セッションを中止します。protected voidtoggleExpandState(TreePath path) パスが展開されてない場合は展開し、行が展開されている場合は折りたたみます。protected voidレンダラ・ペインをアンインストールします。protected void既定のプロパティをアンインストールします。protected voidキーボード操作の登録を解除します。protected voidリスナーを登録解除します。protected voidgetPreferredSize()から返されるpreferredSizeインスタンス変数を更新します。protected void現在含まれているJTreeが編集できるかどうかに応じてcellEditorを更新します。protected void各深さをどのくらいオフセットするべきかを更新します。protected voidツリーから展開されている子孫を取得し、ツリー状態に転送することで、pathのすべての子孫の展開状態を更新します。protected voidJTreeで展開されているすべてのノードをLayoutCacheで展開します。protected void選択のリード行を更新します。protected voidレンダラが変更されたときにツリーからメッセージとして送られます。protected voidキャッシュされているサイズを無効とマークし、treeDidChangeでメッセージをツリーに送ります。クラスで宣言されたメソッド ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, installUI, paint, uninstallUI, update修飾子と型メソッド説明booleancontains(JComponent c, int x, int y) 指定された x,yの位置が、指定されたコンポーネントのLook & Feel定義の形状内にある場合は、trueを返します。getAccessibleChild(JComponent c, int i) オブジェクトのi番目のAccessibleの子を返します。intオブジェクト内のアクセシビリティ対応の子の数を返します。void指定されたコンポーネントをLook & Feelに応じて適切に構成します。voidpaint(Graphics g, JComponent c) 指定されたコンポーネントをLook & Feelに合わせてペイントします。voidinstallUI時に、指定されたコンポーネントに対して行われた構成を取り消します。voidupdate(Graphics g, JComponent c) 指定されたコンポーネントをペイントする時間になったことを、このUI委譲に通知します。クラスオブジェクトで宣言されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait修飾子と型メソッド説明protected Objectclone()このオブジェクトのコピーを作成して、返します。booleanこのオブジェクトと他のオブジェクトが等しいかどうかを示します。protected voidfinalize()削除予定のため非推奨: このAPI要素は、将来のバージョンで削除される可能性があります。最終決定は非推奨であり、将来のリリースで削除される可能性があります。final Class<?> getClass()このObjectの実行時クラスを返します。inthashCode()このオブジェクトに対するハッシュ・コード値を返します。final voidnotify()このオブジェクトのモニターで待機中のスレッドを1つ再開します。final voidこのオブジェクトのモニターで待機中のすべてのスレッドを再開します。toString()オブジェクトの文字列表現を返します。final voidwait()現在のスレッドが目覚めるまで待機します。通常、notifiedまたはinterruptedです。final voidwait(long timeoutMillis) 現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。final voidwait(long timeoutMillis, int nanos) 現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
-
コンストラクタの詳細
-
MetalTreeUI
public MetalTreeUI()MetalTreeUIを構築します。
-
-
メソッドの詳細
-
createUI
public static ComponentUI createUI(JComponent x) MetalTreeUIを構築します。- パラメータ:
x- コンポーネント- 戻り値:
MetalTreeUIのインスタンス
-
decodeLineStyle
protected void decodeLineStyle(Object lineStyleFlag) クライアント・プロパティに渡された文字列と内部表現の間の変換(現在およびint)- パラメータ:
lineStyleFlag- フラグ
-
isLocationInExpandControl
protected boolean isLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY) X座標mouseXおよびY座標mouseYを持つポイントが拡張コントロールにある場合、trueを返します。- パラメータ:
row- 行rowLevel- 行レベルmouseX- X座標mouseY- Y座標- 戻り値:
- X座標
mouseXおよびY座標mouseYを持つポイントが拡張コントロールにある場合は、true。
-
paintHorizontalSeparators
protected void paintHorizontalSeparators(Graphics g, JComponent c) 水平セパレータをペイントします。- パラメータ:
g-Graphicsのインスタンスc- コンポーネント
-