|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.ButtonUI
javax.swing.plaf.MenuItemUI
javax.swing.plaf.basic.BasicMenuItemUI
public class BasicMenuItemUI
BasicMenuItem 實作
| 巢狀類別摘要 | |
|---|---|
protected class |
BasicMenuItemUI.MouseInputHandler
|
| 欄位摘要 | |
|---|---|
protected Font |
acceleratorFont
|
protected Color |
acceleratorForeground
|
protected Color |
acceleratorSelectionForeground
|
protected Icon |
arrowIcon
|
protected Icon |
checkIcon
|
protected int |
defaultTextIconGap
|
protected Color |
disabledForeground
|
protected MenuDragMouseListener |
menuDragMouseListener
|
protected JMenuItem |
menuItem
|
protected MenuKeyListener |
menuKeyListener
|
protected MouseInputListener |
mouseInputListener
|
protected boolean |
oldBorderPainted
|
protected PropertyChangeListener |
propertyChangeListener
從 createPropertyChangeListener 返回的 PropertyChangeListener。 |
protected Color |
selectionBackground
|
protected Color |
selectionForeground
|
| 建構子摘要 | |
|---|---|
BasicMenuItemUI()
|
|
| 方法摘要 | |
|---|---|
protected MenuDragMouseListener |
createMenuDragMouseListener(JComponent c)
|
protected MenuKeyListener |
createMenuKeyListener(JComponent c)
|
protected MouseInputListener |
createMouseInputListener(JComponent c)
|
protected PropertyChangeListener |
createPropertyChangeListener(JComponent c)
創建一個將被添加到選單項的 PropertyChangeListener。 |
static ComponentUI |
createUI(JComponent c)
|
protected void |
doClick(MenuSelectionManager msm)
要啟動選單項時調用此方法。 |
Dimension |
getMaximumSize(JComponent c)
返回指定元件的適合外觀的最大大小。 |
Dimension |
getMinimumSize(JComponent c)
返回指定元件的適合外觀的最小大小。 |
MenuElement[] |
getPath()
|
protected Dimension |
getPreferredMenuItemSize(JComponent c,
Icon checkIcon,
Icon arrowIcon,
int defaultTextIconGap)
|
Dimension |
getPreferredSize(JComponent c)
返回指定元件的適合外觀的首選大小。 |
protected String |
getPropertyPrefix()
|
protected void |
installComponents(JMenuItem menuItem)
|
protected void |
installDefaults()
|
protected void |
installKeyboardActions()
|
protected void |
installListeners()
|
void |
installUI(JComponent c)
配置指定元件,使其適合外觀。 |
void |
paint(Graphics g,
JComponent c)
繪製指定元件,使其適合外觀。 |
protected void |
paintBackground(Graphics g,
JMenuItem menuItem,
Color bgColor)
繪製選單項的背景。 |
protected void |
paintMenuItem(Graphics g,
JComponent c,
Icon checkIcon,
Icon arrowIcon,
Color background,
Color foreground,
int defaultTextIconGap)
|
protected void |
paintText(Graphics g,
JMenuItem menuItem,
Rectangle textRect,
String text)
呈現當前選單項的文本。 |
protected void |
uninstallComponents(JMenuItem menuItem)
|
protected void |
uninstallDefaults()
|
protected void |
uninstallKeyboardActions()
|
protected void |
uninstallListeners()
|
void |
uninstallUI(JComponent c)
在 installUI 期間,在指定元件上反向執行的配置操作。 |
void |
update(Graphics g,
JComponent c)
使用 paintMenuItem() 繪製背景,從而覆寫 update(預設情況下填充不透明元件的背景)以調用 paint()。 |
| 從類別 javax.swing.plaf.ComponentUI 繼承的方法 |
|---|
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 欄位詳細資訊 |
|---|
protected JMenuItem menuItem
protected Color selectionBackground
protected Color selectionForeground
protected Color disabledForeground
protected Color acceleratorForeground
protected Color acceleratorSelectionForeground
protected int defaultTextIconGap
protected Font acceleratorFont
protected MouseInputListener mouseInputListener
protected MenuDragMouseListener menuDragMouseListener
protected MenuKeyListener menuKeyListener
protected PropertyChangeListener propertyChangeListener
createPropertyChangeListener 返回的 PropertyChangeListener。不需要存取此欄位,如果想要定制 PropertyChangeListener,則覆寫 createPropertyChangeListener。
createPropertyChangeListener(javax.swing.JComponent)protected Icon arrowIcon
protected Icon checkIcon
protected boolean oldBorderPainted
| 建構子詳細資訊 |
|---|
public BasicMenuItemUI()
| 方法詳細資訊 |
|---|
public static ComponentUI createUI(JComponent c)
public void installUI(JComponent c)
ComponentUI 複製的描述ComponentUI 實例將作為 UI 委託安裝在指定元件上時,可調用此方法。此方法應該為外觀完整地配置元件,包括以下方面:
LayoutManager。
PropertyChangeListener。
ComponentUI 中的 installUIc - 將安裝此 UI 委託的元件ComponentUI.uninstallUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()protected void installDefaults()
protected void installComponents(JMenuItem menuItem)
protected String getPropertyPrefix()
protected void installListeners()
protected void installKeyboardActions()
public void uninstallUI(JComponent c)
ComponentUI 複製的描述installUI 期間,在指定元件上反向執行的配置操作。當此 UIComponent 實例將作為 UI 委託從指定元件上移除時,可調用此方法。此方法應該取消在 installUI 中執行的配置操作,非常小心地使 JComponent 實例處於某種潔淨狀態(沒有額外的偵聽器、沒有特定於外觀的屬性物件等等)。配置內容應該套件括以下方面:
ComponentUI 中的 uninstallUIc - 從中移除此 UI 委託的元件;此參數常被忽略,但如果 UI 物件是無狀態的並由多個元件共享,則可以使用該參數ComponentUI.installUI(javax.swing.JComponent),
JComponent.updateUI()protected void uninstallDefaults()
protected void uninstallComponents(JMenuItem menuItem)
protected void uninstallListeners()
protected void uninstallKeyboardActions()
protected MouseInputListener createMouseInputListener(JComponent c)
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)
protected MenuKeyListener createMenuKeyListener(JComponent c)
protected PropertyChangeListener createPropertyChangeListener(JComponent c)
PropertyChangeListener。如果此方法返回 null,則它將不會被添加到選單項。
PropertyChangeListener 的實例或 nullpublic Dimension getMinimumSize(JComponent c)
ComponentUI 複製的描述null,則最小大小將由元件的佈局管理器計算(對於安裝了特定佈局管理器的元件而言,這是首選方法)。此方法的預設實作調用 getPreferredSize 並返回該值。
ComponentUI 中的 getMinimumSizec - 將查詢其最小大小的元件;此參數常被忽略,但如果 UI 物件是無狀態的並由多個元件共享,則可以使用該參數
Dimension 物件或 nullJComponent.getMinimumSize(),
LayoutManager.minimumLayoutSize(java.awt.Container),
ComponentUI.getPreferredSize(javax.swing.JComponent)public Dimension getPreferredSize(JComponent c)
ComponentUI 複製的描述null,則首選大小將由元件的佈局管理器計算(對於安裝了特定佈局管理器的元件而言,這是首選方法)。此方法的預設實作返回 null。
ComponentUI 中的 getPreferredSizec - 將查詢其首選大小的元件;此參數常被忽略,但如果 UI 物件是無狀態的並由多個元件共享,則可以使用該參數JComponent.getPreferredSize(),
LayoutManager.preferredLayoutSize(java.awt.Container)public Dimension getMaximumSize(JComponent c)
ComponentUI 複製的描述null,則最大大小將由元件的佈局管理器計算(對於安裝了特定佈局管理器的元件而言,這是首選方法)。此方法的預設實作調用 getPreferredSize 並返回該值。
ComponentUI 中的 getMaximumSizec - 將查詢其最大大小的元件;此參數常被忽略,但如果 UI 物件是無狀態的並由多個元件共享,則可以使用該參數
Dimension 物件或 nullJComponent.getMaximumSize(),
LayoutManager2.maximumLayoutSize(java.awt.Container)
protected Dimension getPreferredMenuItemSize(JComponent c,
Icon checkIcon,
Icon arrowIcon,
int defaultTextIconGap)
public void update(Graphics g,
JComponent c)
ComponentUI 中的 updateg - 將在其中進行繪製的 Graphics 上下文c - 將繪製的元件;此參數常被忽略,但如果 UI 物件是無狀態的並由多個元件共享,則可以使用該參數ComponentUI.paint(java.awt.Graphics, javax.swing.JComponent),
JComponent.paintComponent(java.awt.Graphics)
public void paint(Graphics g,
JComponent c)
ComponentUI 複製的描述ComponentUI.update 方法中調用此方法。子類別應該覆寫此方法並使用指定 Graphics 物件來呈現元件的內容。
ComponentUI 中的 paintg - 將在其中進行繪製的 Graphics 上下文c - 將繪製的元件;此參數常被忽略,但如果 UI 物件是無狀態的並由多個元件共享,則可以使用該參數ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
protected void paintMenuItem(Graphics g,
JComponent c,
Icon checkIcon,
Icon arrowIcon,
Color background,
Color foreground,
int defaultTextIconGap)
protected void paintBackground(Graphics g,
JMenuItem menuItem,
Color bgColor)
g - 繪製圖形menuItem - 要繪製的選單項bgColor - 選擇背景色
protected void paintText(Graphics g,
JMenuItem menuItem,
Rectangle textRect,
String text)
g - 圖形上下文menuItem - 要呈現的選單項textRect - 用於呈現文本的邊界矩形text - 要呈現的字元串public MenuElement[] getPath()
protected void doClick(MenuSelectionManager msm)
msm - MenuSelectionManager。將可視化反饋和內部簿記任務委託給此 MenuSelectionManager。如果將 null 作為此方法的參數傳遞,則使用 MenuSelectionManager.defaultManager。MenuSelectionManager,
AbstractButton.doClick(int)
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。