- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.SpinnerUI
-
- javax.swing.plaf.basic.BasicSpinnerUI
-
- 已知直接子类:
-
SynthSpinnerUI
public class BasicSpinnerUI extends SpinnerUI
默认的Spinner UI委托。- 从以下版本开始:
- 1.4
-
-
构造方法摘要
构造方法 Constructor 描述 BasicSpinnerUI()
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 protected JComponentcreateEditor()该方法由installUI调用,以获取JSpinner的编辑器组件。protected LayoutManagercreateLayout()创建一个LayoutManager管理的editor,nextButton,并previousButton的JSpinner的儿童。protected ComponentcreateNextButton()创建一个增量按钮,即使用spinner.getNextValue返回的对象替换微调spinner.getNextValue值的spinner.getNextValue。protected ComponentcreatePreviousButton()创建一个减量按钮,即用spinner.getPreviousValue返回的对象替换微调spinner.getPreviousValue值的spinner.getPreviousValue。protected PropertyChangeListenercreatePropertyChangeListener()创建一个可以添加到JSpinner本身的PropertyChangeListener。static ComponentUIcreateUI(JComponent c)返回一个新的BasicSpinnerUI实例。intgetBaseline(JComponent c, int width, int height)返回基线。Component.BaselineResizeBehaviorgetBaselineResizeBehavior(JComponent c)返回一个枚举,指示组件的基线如何随着大小的变化而改变。protected voidinstallDefaults()初始化JSpinnerborder,foreground和background基于从默认值表中对应的“微调。*”的属性,属性。protected voidinstallKeyboardActions()将键盘操作安装到JSpinner上。protected voidinstallListeners()使用共享对象初始化PropertyChangeListener,该共享对象将有趣的PropertyChangeEvents委托给受保护的方法。protected voidinstallNextButtonListeners(Component c)在下一个按钮c安装必要的听众,以更新JSpinner以响应用户的手势。protected voidinstallPreviousButtonListeners(Component c)在上一个按钮c上安装必要的听众,以更新JSpinner以响应用户的手势。voidinstallUI(JComponent c)电话installDefaults,installListeners,然后将返回的组件createNextButton,createPreviousButton,并createEditor。protected voidreplaceEditor(JComponent oldEditor, JComponent newEditor)由被叫PropertyChangeListener当JSpinner编辑属性更改。protected voiduninstallDefaults()将JSpinner's布局管理器设置为null。protected voiduninstallListeners()删除由PropertyChangeListener添加的PropertyChangeListener。voiduninstallUI(JComponent c)电话uninstallDefaults,uninstallListeners,然后删除所有的纺纱孩子。-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, paint, update
-
-
-
-
字段详细信息
-
spinner
protected JSpinner spinner
我们是一个UI委托的微调器。 由installUI方法初始化,并通过uninstallUI重置为null。
-
-
方法详细信息
-
createUI
public static ComponentUI createUI(JComponent c)
返回一个新的BasicSpinnerUI实例。 SpinnerListUI代理每JSpinner分配一个。- 参数
-
c- JSpinner(未使用) - 结果
- 一个新的BasicSpinnerUI对象
- 另请参见:
-
ComponentUI.createUI(javax.swing.JComponent)
-
installUI
public void installUI(JComponent c)
电话installDefaults,installListeners,然后将返回的组件createNextButton,createPreviousButton,并createEditor。- 重写:
-
installUI在ComponentUI - 参数
-
c- JSpinner - 另请参见:
-
installDefaults(),installListeners(),createNextButton(),createPreviousButton(),createEditor()
-
uninstallUI
public void uninstallUI(JComponent c)
电话uninstallDefaults,uninstallListeners,然后删除所有的纺纱孩子。- 重写:
-
uninstallUI在ComponentUI - 参数
-
c- JSpinner(未使用) - 另请参见:
-
ComponentUI.installUI(javax.swing.JComponent),JComponent.updateUI()
-
installListeners
protected void installListeners()
使用共享对象初始化PropertyChangeListener,该对象将感兴趣的PropertyChangeEvents委托给受保护的方法。此方法由
installUI。
-
uninstallListeners
protected void uninstallListeners()
删除由PropertyChangeListener添加的PropertyChangeListener。此方法由
uninstallUI。- 另请参见:
-
installListeners()
-
installDefaults
protected void installDefaults()
初始化JSpinnerborder,foreground和background基于从默认值表中对应的“微调。*”的属性,属性。JSpinners布局设置为由createLayout返回的值。 此方法由installUI。
-
uninstallDefaults
protected void uninstallDefaults()
将JSpinner's布局管理器设置为null。 此方法由uninstallUI。
-
installNextButtonListeners
protected void installNextButtonListeners(Component c)
在下一个按钮c安装必要的听众,以更新JSpinner以响应用户的手势。- 参数
-
c- 安装监听器的组件 - 异常
-
NullPointerException- 如果c为空。 - 从以下版本开始:
- 1.5
- 另请参见:
-
createNextButton()
-
installPreviousButtonListeners
protected void installPreviousButtonListeners(Component c)
在上一个按钮c上安装必要的听众,以更新JSpinner以响应用户的手势。- 参数
-
c- 安装监听器的组件。 - 异常
-
NullPointerException- 如果c为空。 - 从以下版本开始:
- 1.5
- 另请参见:
-
createPreviousButton()
-
createLayout
protected LayoutManager createLayout()
创建一个LayoutManager管理的editor,nextButton,并previousButton的JSpinner的儿童。 这三个孩子必须添加一个约束来标识其角色:“编辑”,“下一步”和“上一个”。 默认布局管理器可以处理这些孩子中没有任何一个。- 结果
- 用于编辑器的LayoutManager,下一个按钮和上一个按钮。
- 另请参见:
-
createNextButton(),createPreviousButton(),createEditor()
-
createPropertyChangeListener
protected PropertyChangeListener createPropertyChangeListener()
创建一个可以添加到JSpinner本身的PropertyChangeListener。 通常,当“编辑器”属性更改时,此侦听器将调用replaceEditor,因为将编辑器添加到JSpinner(并删除旧文件)是SpinnerUI's责任。 此方法由installListeners。- 结果
- JSpinner本身的PropertyChangeListener
- 另请参见:
-
installListeners()
-
createPreviousButton
protected Component createPreviousButton()
创建一个减量按钮,即使用由spinner.getPreviousValue返回的对象替换微调spinner.getPreviousValue值的spinner.getPreviousValue。 默认情况下,previousButton是JButton。 如果不需要减量按钮,则此方法应返回null。- 结果
-
将使用序列中的先前值替换微调器值的组件,或
null - 另请参见:
-
installUI(javax.swing.JComponent),createNextButton(),installPreviousButtonListeners(java.awt.Component)
-
createNextButton
protected Component createNextButton()
创建一个增量按钮,即用spinner.getNextValue返回的对象替换微调spinner.getNextValue值的spinner.getNextValue。 默认情况下,nextButton是JButton。 如果不需要增量按钮,则此方法应返回null。- 结果
-
将使用序列中的下一个值替换微调器值的组件,或
null - 另请参见:
-
installUI(javax.swing.JComponent),createPreviousButton(),installNextButtonListeners(java.awt.Component)
-
createEditor
protected JComponent createEditor()
该方法由installUI调用,以获得JSpinner的编辑器组件。 默认情况下只返回JSpinner.getEditor()。 子类可以重写createEditor返回包含微调的编辑器或空,如果他们要处理添加编辑器的组件JSpinner在installUI覆盖。通常,这个方法将被覆盖,使编辑器包含带有自定义边框的容器,因为不能假定编辑器边框可以直接设置。
当使用
JSpinner.setEditor更改纺纱编辑器时,将调用replaceEditor方法。 如果你已经覆盖了这个方法,那么你也可能要重写replaceEditor。- 结果
- JSpinners编辑器JComponent,spinner.getEditor()默认情况下
- 另请参见:
-
installUI(javax.swing.JComponent),replaceEditor(javax.swing.JComponent, javax.swing.JComponent),JSpinner.getEditor()
-
replaceEditor
protected void replaceEditor(JComponent oldEditor, JComponent newEditor)
由被叫PropertyChangeListener当JSpinner编辑属性更改。 删除旧编辑器并添加新编辑器是有责任的。 默认情况下这个操作只是:spinner.remove(oldEditor); spinner.add(newEditor, "Editor");replaceEditor的实施应与createEditor方法协调。- 参数
-
oldEditor- 一个旧的编辑器 -
newEditor- 一个新的编辑实例 - 另请参见:
-
createEditor(),createPropertyChangeListener()
-
installKeyboardActions
protected void installKeyboardActions()
将键盘操作安装到JSpinner上。- 从以下版本开始:
- 1.5
-
getBaseline
public int getBaseline(JComponent c, int width, int height)
返回基线。- 重写:
-
getBaseline在ComponentUI - 参数
-
c-JComponent正在请求基准 -
width- 获取基准的宽度 -
height- 获取基准的高度 - 结果
- 基线或值<0表示没有合理的基线
- 异常
-
NullPointerException- 如果c是null -
IllegalArgumentException- 如果宽度或高度<0 - 从以下版本开始:
- 1.6
- 另请参见:
-
JComponent.getBaseline(int, int)
-
getBaselineResizeBehavior
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
返回一个枚举,指示组件的基线如何随着大小的变化而改变。- 重写:
-
getBaselineResizeBehavior在ComponentUI - 参数
-
c-JComponent返回基准调整大小行为 - 结果
- 一个枚举,指示基准随着组件大小的变化而改变
- 异常
-
NullPointerException- 如果c是null - 从以下版本开始:
- 1.6
- 另请参见:
-
JComponent.getBaseline(int, int)
-
-