public class BasicSpinnerUI extends SpinnerUI
| コンストラクタ | 説明 | 
|---|---|
| BasicSpinnerUI() | 
| 修飾子と型 | メソッド | 説明 | 
|---|---|---|
| protected JComponent | createEditor() | このメソッドはinstallUIにより呼び出され、 JSpinnerのエディタ・コンポーネントを取得します。 | 
| protected LayoutManager | createLayout() | JSpinnerの子である editor、nextButton、およびpreviousButtonを管理するLayoutManagerを作成します。 | 
| protected Component | createNextButton() | 増分ボタンを作成します。 | 
| protected Component | createPreviousButton() | 減分ボタンを作成します。 | 
| 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() | デフォルト・テーブルからの対応する「Spinner.*」プロパティに基づくプロパティ JSpinner、border、foreground、およびbackgroundを初期化します。 | 
| protected void | installKeyboardActions() | キーボードActionをJSpinnerにインストールします。 | 
| protected void | installListeners() | 対象のPropertyChangeEventをprotectedメソッドに委譲する共用オブジェクトで、 PropertyChangeListenerを初期化します。 | 
| protected void | installNextButtonListeners(Component c) | ユーザーのジェスチャに応じて JSpinnerを更新するために必要なリスナーを、「次」ボタンcにインストールします。 | 
| protected void | installPreviousButtonListeners(Component c) | ユーザーのジェスチャに応じて JSpinnerを更新するために必要なリスナーを、「戻る」ボタンcにインストールします。 | 
| 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() | installListenerによって追加された PropertyChangeListenerを削除します。 | 
| void | uninstallUI(JComponent c) | uninstallDefaultsとuninstallListenersを呼び出し、スピナーの子をすべて削除します。 | 
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, paint, updateprotected JSpinner spinner
installUIメソッドで初期化され、uninstallUIでnullにリセットされます。 public static ComponentUI createUI(JComponent c)
c - JSpinner (未使用)ComponentUI.createUI(javax.swing.JComponent)public void installUI(JComponent c)
installDefaultsとinstallListenersを呼び出し、createNextButton、createPreviousButton、およびcreateEditorから返されるコンポーネントを追加します。installUI、クラスComponentUIc - JSpinnerinstallDefaults(), installListeners(), createNextButton(), createPreviousButton(), createEditor()public void uninstallUI(JComponent c)
uninstallDefaultsとuninstallListenersを呼び出し、スピナーの子をすべて削除します。uninstallUI、クラスComponentUIc - JSpinner (未使用)ComponentUI.installUI(javax.swing.JComponent), JComponent.updateUI()protected void installListeners()
PropertyChangeListenerを初期化します。
 
 このメソッドはinstallUIにより呼び出されます。
protected void uninstallListeners()
PropertyChangeListenerを削除します。
 
 このメソッドはuninstallUIにより呼び出されます。
installListeners()protected void installDefaults()
JSpinner、border、foreground、およびbackgroundを初期化します。 JSpinnersレイアウトは、createLayoutが返す値に設定されます。 このメソッドはinstallUIにより呼び出されます。 protected void uninstallDefaults()
JSpinnerのレイアウト・マネージャをnullに設定します。 このメソッドはuninstallUIにより呼び出されます。 protected void installNextButtonListeners(Component c)
JSpinnerを更新するために必要なリスナーを、「次」ボタンcにインストールします。c - リスナーのインストール先のコンポーネントNullPointerException - cがnullである場合。createNextButton()protected void installPreviousButtonListeners(Component c)
JSpinnerを更新するために必要なリスナーを、「戻る」ボタンcにインストールします。c - リスナーのインストール先のコンポーネント。NullPointerException - cがnullである場合。createPreviousButton()protected LayoutManager createLayout()
editor、nextButton、およびpreviousButtonを管理するLayoutManagerを作成します。 これらの3つの子は、それらの役割(「エディタ」、「次」、および「前」)を識別する制約と一緒に追加される必要があります。 デフォルトのレイアウト・マネージャは、これらの子のいずれかが欠けている場合にも対処できます。 createNextButton(), createPreviousButton(), createEditor()protected PropertyChangeListener createPropertyChangeListener()
PropertyChangeListenerを作成します。 通常は、「エディタ」プロパティの変更がある場合、このリスナーがreplaceEditorを呼び出します。SpinnerUIの役割は、エディタをJSpinnerに追加し、古いエディタを削除することです。 このメソッドはinstallListenersにより呼び出されます。 installListeners()protected Component createPreviousButton()
spinner.getPreviousValueによって返されたオブジェクトで置き換えるコンポーネントを作成します。 デフォルトでは、previousButtonはJButtonです。 減分ボタンが必要ない場合、このメソッドはnullを返すはずです。 nullinstallUI(javax.swing.JComponent), createNextButton(), installPreviousButtonListeners(java.awt.Component)protected Component createNextButton()
spinner.getNextValueによって返されたオブジェクトで置き換えるコンポーネントを作成します。 デフォルトでは、nextButtonはJButtonです。 増分ボタンが必要ない場合、このメソッドはnullを返すはずです。 nullinstallUI(javax.swing.JComponent), createPreviousButton(), installNextButtonListeners(java.awt.Component)protected JComponent createEditor()
JSpinnerのエディタ・コンポーネントを取得します。 デフォルトでは、JSpinner.getEditor()を返すだけです。 サブクラスは、スピナーのエディタを含むコンポーネントまたはnull (JSpinnerへのエディタの追加をinstallUIオーバーライドで処理する場合)を返すために、createEditorをオーバーライドできます。 
 このメソッドは通常、カスタム・ボーダーを含むコンテナでエディタをラップするためにオーバーライドされます(エディタ・ボーダーを直接設定できることは想定できないため)。
 スピナー・エディタがJSpinner.setEditorで変更されるときは、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メソッドと一緒に調整するようにしてください。protected void installKeyboardActions()
public int getBaseline(JComponent c, int width, int height)
getBaseline、クラスComponentUIc - ベースラインが要求されるJComponentwidth - ベースラインを取得する幅height - ベースラインを取得する高さNullPointerException - cがnullである場合IllegalArgumentException - 幅または高さが0より小さい場合JComponent.getBaseline(int, int)public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior、クラスComponentUIc - ベースラインのサイズ変更の動作を返すJComponentNullPointerException - cがnullである場合JComponent.getBaseline(int, int) バグまたは機能を送信 
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。 
 Copyright © 1993, 2025, Oracle and/or its affiliates.  All rights reserved.  Use is subject to license terms.  Documentation Redistribution Policyも参照してください。