public class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener, SynthUI
JSpinnerのSynth L&F UIの委譲を提供します。spinnerDEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED| コンストラクタと説明 |
|---|
SynthSpinnerUI() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected JComponent |
createEditor()
このメソッドはinstallUIにより呼び出され、
JSpinnerのエディタ・コンポーネントを取得します。 |
protected LayoutManager |
createLayout()
JSpinnerの子である
editor、nextButton、およびpreviousButtonを管理するLayoutManagerを作成します。 |
protected Component |
createNextButton()
増分ボタンを作成します。
|
protected Component |
createPreviousButton()
減分ボタンを作成します。
|
static ComponentUI |
createUI(JComponent c)
SynthSpinnerUIの新しいインスタンスを返します。
|
SynthContext |
getContext(JComponent c)
指定されたコンポーネントのコンテキストを返します。
|
protected void |
installDefaults()
デフォルト・テーブルの対応する「Spinner.*」プロパティに基づくプロパティ
JSpinner、border、foreground、およびbackgroundを初期化します。 |
protected void |
installListeners()
対象のPropertyChangeEventをprotectedメソッドに委譲する共用オブジェクトで、
PropertyChangeListenerを初期化します。 |
void |
paint(Graphics g, JComponent c)
Look & Feelに従って、指定されたコンポーネントをペイントします。
|
protected void |
paint(SynthContext context, Graphics g)
指定されたコンポーネントをペイントします。
|
void |
paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
ボーダーをペイントします。
|
void |
propertyChange(PropertyChangeEvent e)
バウンド・プロパティの変更時に呼び出されます。
|
protected void |
replaceEditor(JComponent oldEditor, JComponent newEditor)
JSpinnerエディタ・プロパティに変更があるときに、PropertyChangeListenerにより呼び出されます。 |
protected void |
uninstallDefaults()
JSpinner'sのレイアウト・マネージャをnullに設定します。 |
protected void |
uninstallListeners()
installListenerによって追加された
PropertyChangeListenerを削除します。 |
void |
update(Graphics g, JComponent c)
このUI委譲に、指定されたコンポーネントを再ペイントするよう通知します。
|
createPropertyChangeListener, getBaseline, getBaselineResizeBehavior, installKeyboardActions, installNextButtonListeners, installPreviousButtonListeners, installUI, uninstallUIcontains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSizepublic static ComponentUI createUI(JComponent c)
c - JSpinner (未使用)ComponentUI.createUI(javax.swing.JComponent)protected void installListeners()
PropertyChangeListenerを初期化します。
このメソッドはinstallUIにより呼び出されます。
protected void uninstallListeners()
PropertyChangeListenerを削除します。
このメソッドはuninstallUIにより呼び出されます。
uninstallListeners、クラス: BasicSpinnerUIBasicSpinnerUI.installListeners()protected void installDefaults()
JSpinner、border、foreground、およびbackgroundを初期化します。JSpinnersレイアウトは、createLayoutが返す値に設定されます。このメソッドはinstallUIにより呼び出されます。protected void uninstallDefaults()
JSpinner'sのレイアウト・マネージャをnullに設定します。このメソッドはuninstallUIにより呼び出されます。protected LayoutManager createLayout()
editor、nextButton、およびpreviousButtonを管理するLayoutManagerを作成します。これらの3つの子は、それらの役割(「エディタ」、「次」、および「前」)を識別する制約と一緒に追加される必要があります。デフォルトのレイアウト・マネージャは、これらの子のいずれかが欠けている場合にも対処できます。createLayout、クラス: BasicSpinnerUIBasicSpinnerUI.createNextButton(), BasicSpinnerUI.createPreviousButton(), BasicSpinnerUI.createEditor()protected Component createPreviousButton()
spinner.getPreviousValueによって返されたオブジェクトで置き換えるコンポーネントを作成します。デフォルトでは、previousButtonはJButtonです。減分ボタンが必要ない場合、このメソッドはnullを返すべきです。createPreviousButton、クラス: BasicSpinnerUInullBasicSpinnerUI.installUI(javax.swing.JComponent), BasicSpinnerUI.createNextButton(), BasicSpinnerUI.installPreviousButtonListeners(java.awt.Component)protected Component createNextButton()
spinner.getNextValueによって返されたオブジェクトで置き換えるコンポーネントを作成します。デフォルトでは、nextButtonはJButtonです。増分ボタンが必要ない場合、このメソッドはnullを返すべきです。createNextButton、クラス: BasicSpinnerUInullBasicSpinnerUI.installUI(javax.swing.JComponent), BasicSpinnerUI.createPreviousButton(), BasicSpinnerUI.installNextButtonListeners(java.awt.Component)protected JComponent createEditor()
JSpinnerのエディタ・コンポーネントを取得します。デフォルトでは、JSpinner.getEditor()を返すだけです。サブクラスは、スピナーのエディタを含むコンポーネントまたはnull (JSpinnerへのエディタの追加をinstallUIオーバーライドで処理する場合)を返すために、createEditorをオーバーライドできます。
このメソッドは通常、カスタム・ボーダーを含むコンテナでエディタをラップするためにオーバーライドされます(エディタ・ボーダーを直接設定できることは想定できないため)。
スピナー・エディタがJSpinner.setEditorで変更されるときは、replaceEditorメソッドが呼び出されます。このメソッドをオーバーライドした場合、同様にreplaceEditorをオーバーライドすることをお勧めします。
createEditor、クラス: BasicSpinnerUIBasicSpinnerUI.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メソッドと調整するようにしてください。replaceEditor、クラス: BasicSpinnerUIcreateEditor(), BasicSpinnerUI.createPropertyChangeListener()public SynthContext getContext(JComponent c)
getContext、インタフェース: SynthUIc - SynthContextを要求するコンポーネント。public void update(Graphics g, JComponent c)
paint(SynthContext,Graphics)メソッドを呼び出します。
一般に、このメソッドはサブクラスによってオーバーライドする必要はありません。すべてのLook & Feelの描画コードをpaintメソッドに入れるようにしてください。
update、クラス: ComponentUIg - ペイントに使用されるGraphicsオブジェクトc - ペイントされるコンポーネントpaint(SynthContext,Graphics)public void paint(Graphics g, JComponent c)
このメソッドは、Synth Look & Feelで使用されません。ペイントはpaint(SynthContext,Graphics)メソッドによって処理されます。
paint、クラス: ComponentUIg - ペイントに使用されるGraphicsオブジェクトc - ペイントされるコンポーネントpaint(SynthContext,Graphics)protected void paint(SynthContext context, Graphics g)
context - ペイントされるコンポーネントのコンテキストg - ペイントに使用されるGraphicsオブジェクトupdate(Graphics,JComponent)public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
paintBorder、インタフェース: SynthUIcontext - コンポーネント・コンテキストg - ペイントされるGraphicsx - X座標y - Y座標w - ボーダーの幅h - ボーダーの高さpublic void propertyChange(PropertyChangeEvent e)
propertyChange、インタフェース: PropertyChangeListenere - イベント・ソースと変更されたプロパティを記述したPropertyChangeEventオブジェクト。 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright© 1993, 2014, Oracle and/or its affiliates. All rights reserved.