|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.TreeUI
javax.swing.plaf.basic.BasicTreeUI
javax.swing.plaf.metal.MetalTreeUI
public class MetalTreeUI
TreeUI 的 metal 外觀實作。
MetalTreeUI 允許配置如何在視覺上呈現節點之間的間隔和描繪。支持以下提示:
Angled |
繪製一條連接子節點和父節點的線。關於如何處理根節點,請參閱 JTree.setRootVisible(boolean) 和 JTree.setShowsRootHandles(boolean)。
|
|---|---|
Horizontal |
繪製用來分隔根節點的子節點的一條水平線。 |
None |
不在節點間繪製任何可見的指示。 |
因為通常無法從 JTree 中獲得 TreeUI 並將它強制轉換成 MetalTreeUI 實例,所以要通過客戶端屬性 JTree.lineStyle 啟用此屬性。例如,要切換成 Horizontal 樣式,需要這樣做:tree.putClientProperty("JTree.lineStyle", "Horizontal");
預設值為 Angled。
| 巢狀類別摘要 |
|---|
| 欄位摘要 |
|---|
| 建構子摘要 | |
|---|---|
MetalTreeUI()
|
|
| 方法摘要 | |
|---|---|
static ComponentUI |
createUI(JComponent x)
|
protected void |
decodeLineStyle(Object lineStyleFlag)
此方法進行傳入客戶端屬性中的字元串和內部表示形式(當前的並且用 int 值表示)之間的轉換 |
protected int |
getHorizontalLegBuffer()
預設情況下,節點間支路的水平元素開始於子節點左側的右邊。 |
void |
installUI(JComponent c)
配置指定元件,使其適合外觀。 |
protected boolean |
isLocationInExpandControl(int row,
int rowLevel,
int mouseX,
int mouseY)
|
void |
paint(Graphics g,
JComponent c)
繪製指定元件,使其適合外觀。 |
protected void |
paintHorizontalPartOfLeg(Graphics g,
Rectangle clipBounds,
Insets insets,
Rectangle bounds,
TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
繪製支路 (leg) 的水平部分。 |
protected void |
paintHorizontalSeparators(Graphics g,
JComponent c)
|
protected void |
paintVerticalPartOfLeg(Graphics g,
Rectangle clipBounds,
Insets insets,
TreePath path)
繪製支路的垂直部分。 |
void |
uninstallUI(JComponent c)
在 installUI 期間,在指定元件上反向執行的配置操作。 |
| 從類別 javax.swing.plaf.ComponentUI 繼承的方法 |
|---|
contains, getAccessibleChild, getAccessibleChildrenCount, update |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
public MetalTreeUI()
| 方法詳細資訊 |
|---|
public static ComponentUI createUI(JComponent x)
protected int getHorizontalLegBuffer()
BasicTreeUI 複製的描述
BasicTreeUI 中的 getHorizontalLegBufferpublic void installUI(JComponent c)
ComponentUI 複製的描述ComponentUI 實例將作為 UI 委託安裝在指定元件上時,可調用此方法。此方法應該為外觀完整地配置元件,包括以下方面:
LayoutManager。
PropertyChangeListener。
BasicTreeUI 中的 installUIc - 將安裝此 UI 委託的元件ComponentUI.uninstallUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()public void uninstallUI(JComponent c)
ComponentUI 複製的描述installUI 期間,在指定元件上反向執行的配置操作。當此 UIComponent 實例將作為 UI 委託從指定元件上移除時,可調用此方法。此方法應該取消在 installUI 中執行的配置操作,非常小心地使 JComponent 實例處於某種潔淨狀態(沒有額外的偵聽器、沒有特定於外觀的屬性物件等等)。配置內容應該套件括以下方面:
BasicTreeUI 中的 uninstallUIc - 從中移除此 UI 委託的元件;此參數常被忽略,但如果 UI 物件是無狀態的並由多個元件共享,則可以使用該參數ComponentUI.installUI(javax.swing.JComponent),
JComponent.updateUI()protected void decodeLineStyle(Object lineStyleFlag)
protected boolean isLocationInExpandControl(int row,
int rowLevel,
int mouseX,
int mouseY)
public void paint(Graphics g,
JComponent c)
ComponentUI 複製的描述ComponentUI.update 方法中調用此方法。子類別應該覆寫此方法並使用指定 Graphics 物件來呈現元件的內容。
BasicTreeUI 中的 paintg - 將在其中進行繪製的 Graphics 上下文c - 將繪製的元件;此參數常被忽略,但如果 UI 物件是無狀態的並由多個元件共享,則可以使用該參數ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
protected void paintHorizontalSeparators(Graphics g,
JComponent c)
protected void paintVerticalPartOfLeg(Graphics g,
Rectangle clipBounds,
Insets insets,
TreePath path)
BasicTreeUI 複製的描述clipBounds、insets。
BasicTreeUI 中的 paintVerticalPartOfLeg
protected void paintHorizontalPartOfLeg(Graphics g,
Rectangle clipBounds,
Insets insets,
Rectangle bounds,
TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
BasicTreeUI 複製的描述clipBounds 或 insets。
註:如果階層樹不可見,則 parentRow 為 -1。
BasicTreeUI 中的 paintHorizontalPartOfLeg
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。