|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.SpinnerUI
javax.swing.plaf.basic.BasicSpinnerUI
public class BasicSpinnerUI
預設 Spinner UI 委託。
| 欄位摘要 | |
|---|---|
protected JSpinner |
spinner
作為 UI 委託的 spinner。 |
| 建構子摘要 | |
|---|---|
BasicSpinnerUI()
|
|
| 方法摘要 | |
|---|---|
protected JComponent |
createEditor()
installUI 通過調用此方法獲取 JSpinner 的編輯器元件。 |
protected LayoutManager |
createLayout()
創建管理 JSpinner 的 editor、nextButton 和 previousButton 子級的 LayoutManager。 |
protected Component |
createNextButton()
創建將用 spinner.getNextValue 返回的物件取代 spinner 模型值的元件。 |
protected Component |
createPreviousButton()
創建將用 spinner.getPreviousValue 返回的物件取代 spinner 模型值的元件。 |
protected PropertyChangeListener |
createPropertyChangeListener()
創建一個可以添加到 JSpinner 本身的 PropertyChangeListener。 |
static ComponentUI |
createUI(JComponent c)
返回 BasicSpinnerUI 的新實例。 |
int |
getBaseline(JComponent c,
int width,
int height)
返回基線。 |
Component.BaselineResizeBehavior |
getBaselineResizeBehavior(JComponent c)
返回一個列舉,它指示該元件的基線如何隨大小的改變而發生更改。 |
protected void |
installDefaults()
初始化 JSpinner border、foreground、background 屬性以及基於預設表中對應的 "Spinner.*" 屬性。 |
protected void |
installKeyboardActions()
在 JSpinner 上安裝鍵盤動作。 |
protected void |
installListeners()
用將感興趣的 PropertyChangeEvent 委託給受保護方法的共享物件初始化 PropertyChangeListener。 |
protected void |
installNextButtonListeners(Component c)
在下一個按鈕( c)上安裝必要的偵聽器以更新 JSpinner 來回應使用者動作。 |
protected void |
installPreviousButtonListeners(Component c)
在上一個按鈕( c)上安裝必要的偵聽器以更新 JSpinner 來回應使用者動作。 |
void |
installUI(JComponent c)
調用 installDefaults、installListeners,然後添加由 createNextButton、createPreviousButton 和 createEditor 返回的元件。 |
protected void |
replaceEditor(JComponent oldEditor,
JComponent newEditor)
當 JSpinner 編輯器屬性更改時,由 PropertyChangeListener 調用。 |
protected void |
uninstallDefaults()
將 JSpinner 的佈局管理器設置為 null。 |
protected void |
uninstallListeners()
移除 installListeners 添加的 PropertyChangeListener。 |
void |
uninstallUI(JComponent c)
調用 uninstallDefaults、uninstallListeners,然後移除所有子 spinner。 |
| 從類別 javax.swing.plaf.ComponentUI 繼承的方法 |
|---|
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, paint, update |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 欄位詳細資訊 |
|---|
protected JSpinner spinner
installUI 方法初始化,並由 uninstallUI 重置為 null。
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)| 建構子詳細資訊 |
|---|
public BasicSpinnerUI()
| 方法詳細資訊 |
|---|
public static ComponentUI createUI(JComponent c)
c - JSpinner(未使用)
ComponentUI.createUI(javax.swing.JComponent)public void installUI(JComponent c)
installDefaults、installListeners,然後添加由 createNextButton、createPreviousButton 和 createEditor 返回的元件。
ComponentUI 中的 installUIc - JSpinnerinstallDefaults(),
installListeners(),
createNextButton(),
createPreviousButton(),
createEditor()public void uninstallUI(JComponent c)
uninstallDefaults、uninstallListeners,然後移除所有子 spinner。
ComponentUI 中的 uninstallUIc - JSpinner(不使用)ComponentUI.installUI(javax.swing.JComponent),
JComponent.updateUI()protected void installListeners()
PropertyChangeListener。
此方法由 installUI 調用。
replaceEditor(javax.swing.JComponent, javax.swing.JComponent),
uninstallListeners()protected void uninstallListeners()
PropertyChangeListener。
此方法由 uninstallUI 調用。
installListeners()protected void installDefaults()
JSpinner border、foreground、background 屬性以及基於預設表中對應的 "Spinner.*" 屬性。將 JSpinner 佈局設置為 createLayout 返回的值。此方法由 installUI 調用。
uninstallDefaults(),
installUI(javax.swing.JComponent),
createLayout(),
LookAndFeel.installBorder(javax.swing.JComponent, java.lang.String),
LookAndFeel.installColors(javax.swing.JComponent, java.lang.String, java.lang.String)protected void uninstallDefaults()
JSpinner 的佈局管理器設置為 null。此方法由 uninstallUI 調用。
installDefaults(),
uninstallUI(javax.swing.JComponent)protected void installNextButtonListeners(Component c)
c)上安裝必要的偵聽器以更新 JSpinner 來回應使用者動作。
c - 要在其上安裝偵聽器的元件
NullPointerException - 如果 c 為 null。createNextButton()protected void installPreviousButtonListeners(Component c)
c)上安裝必要的偵聽器以更新 JSpinner 來回應使用者動作。
c - 要在其上安裝偵聽器的元件。
NullPointerException - 如果 c 為 null。createPreviousButton()protected LayoutManager createLayout()
editor、nextButton 和 previousButton 子級的 LayoutManager。必須用標識其職責的約束添加這三個子級:"Editor"、"Next"、和 "Previous"。預設的佈局管理器可以處理缺少這些子級中任意一個的情況。
createNextButton(),
createPreviousButton(),
createEditor()protected PropertyChangeListener createPropertyChangeListener()
PropertyChangeListener。通常,此偵聽器將在“編輯器”屬性更改時調用 replaceEditor,因為它的 SpinnerUI 負責將編輯器添加到 JSpinner(並移除舊的)。此方法由 installListeners 調用。
installListeners()protected Component createPreviousButton()
spinner.getPreviousValue 返回的物件取代 spinner 模型值的元件。預設情況下 previousButton 為 JButton。此方法通過調用 installPreviousButtonListeners 安裝必需的偵聽器以更新 JSpinner 的模型來回應使用者動作。如果不需要 previousButton(在子類別中),則覆寫此方法以返回 null。
installUI(javax.swing.JComponent),
createNextButton(),
installPreviousButtonListeners(java.awt.Component)protected Component createNextButton()
spinner.getNextValue 返回的物件取代 spinner 模型值的元件。預設情況下,nextButton 即為 JButton,其 ActionListener 更新其 JSpinner 祖先模型。如果不需要 nextButton(在子類別中),則覆寫此方法以返回 null。
installUI(javax.swing.JComponent),
createPreviousButton(),
installNextButtonListeners(java.awt.Component)protected JComponent createEditor()
JSpinner 的編輯器元件。預設情況下它僅返回 JSpinner.getEditor()。如果子類別要使用覆寫的 installUI 將編輯器添加到 JSpinner 中,則其可以覆寫 createEditor 來返回包含 spinner 的編輯器的元件或 null。
通常覆寫此方法以利用帶有自定義邊框的容器包裹編輯器,因為不能假定可以直接設置編輯器的邊框。
利用 JSpinner.setEditor 更改 spinner 的編輯器時調用 replaceEditor 方法。如果已覆寫此方法,則可能還要覆寫 replaceEditor。
installUI(javax.swing.JComponent),
replaceEditor(javax.swing.JComponent, javax.swing.JComponent),
JSpinner.getEditor()
protected void replaceEditor(JComponent oldEditor,
JComponent newEditor)
JSpinner 編輯器屬性更改時,由 PropertyChangeListener 調用。此方法負責移除舊編輯器並添加新編輯器。預設情況下,此操作為:
spinner.remove(oldEditor); spinner.add(newEditor, "Editor");
replaceEditor 的實作應該配合 createEditor 方法使用。
createEditor(),
createPropertyChangeListener()protected void installKeyboardActions()
public int getBaseline(JComponent c,
int width,
int height)
ComponentUI 中的 getBaselinec - 為其請求基線的 JComponentwidth - 為其獲取基線的寬度height - 為其獲取基線的高度
NullPointerException - 如果 c 為 null
IllegalArgumentException - 如果寬度或高度 < 0JComponent.getBaseline(int, int)public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
ComponentUI 中的 getBaselineResizeBehaviorc - 為其返回調整大小行為的 JComponent
NullPointerException - 如果 c 為 nullJComponent.getBaseline(int, int)
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。