public class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener, SynthUI
JSpinner
のSynth L&F UIの委譲を提供します。spinner
DEFAULT, 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, uninstallUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize
public static ComponentUI createUI(JComponent c)
c
- JSpinner (未使用)ComponentUI.createUI(javax.swing.JComponent)
protected void installListeners()
PropertyChangeListener
を初期化します。
このメソッドはinstallUI
により呼び出されます。
protected void uninstallListeners()
PropertyChangeListener
を削除します。
このメソッドはuninstallUI
により呼び出されます。
uninstallListeners
、クラスBasicSpinnerUI
BasicSpinnerUI.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
、クラスBasicSpinnerUI
BasicSpinnerUI.createNextButton()
, BasicSpinnerUI.createPreviousButton()
, BasicSpinnerUI.createEditor()
protected Component createPreviousButton()
spinner.getPreviousValue
によって返されたオブジェクトで置き換えるコンポーネントを作成します。 デフォルトでは、previousButton
はJButton
です。 減分ボタンが必要ない場合、このメソッドはnull
を返すべきです。 createPreviousButton
、クラスBasicSpinnerUI
null
BasicSpinnerUI.installUI(javax.swing.JComponent)
, BasicSpinnerUI.createNextButton()
, BasicSpinnerUI.installPreviousButtonListeners(java.awt.Component)
protected Component createNextButton()
spinner.getNextValue
によって返されたオブジェクトで置き換えるコンポーネントを作成します。 デフォルトでは、nextButton
はJButton
です。 増分ボタンが必要ない場合、このメソッドはnull
を返すべきです。 createNextButton
、クラスBasicSpinnerUI
null
BasicSpinnerUI.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
、クラスBasicSpinnerUI
BasicSpinnerUI.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
、クラスBasicSpinnerUI
createEditor()
, BasicSpinnerUI.createPropertyChangeListener()
public SynthContext getContext(JComponent c)
getContext
、インタフェースSynthUI
c
- SynthContextを要求するコンポーネント。public void update(Graphics g, JComponent c)
paint(SynthContext,Graphics)
メソッドを呼び出します。
一般に、このメソッドはサブクラスによってオーバーライドする必要はありません。 すべてのLook & Feelの描画コードをpaint
メソッドに入れるようにしてください。
update
、クラスComponentUI
g
- ペイントに使用されるGraphics
オブジェクトc
- ペイントされるコンポーネントpaint(SynthContext,Graphics)
public void paint(Graphics g, JComponent c)
このメソッドは、Synth Look & Feelで使用されません。 ペイントはpaint(SynthContext,Graphics)
メソッドによって処理されます。
paint
、クラスComponentUI
g
- ペイントに使用される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
、インタフェースSynthUI
context
- コンポーネント・コンテキストg
- ペイントされるGraphics
x
- X座標y
- Y座標w
- ボーダーの幅h
- ボーダーの高さpublic void propertyChange(PropertyChangeEvent e)
propertyChange
、インタフェースPropertyChangeListener
e
- イベント・ソースと変更されたプロパティを記述したPropertyChangeEventオブジェクト。 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。