public class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener, SynthUI
JSpinner
。
spinner
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
Constructor and Description |
---|
SynthSpinnerUI() |
Modifier and Type | Method and Description |
---|---|
protected JComponent |
createEditor()
这种方法被称为installui得到的
JSpinner 编辑组件。
|
protected LayoutManager |
createLayout()
创建一个
LayoutManager 管理
editor ,
nextButton ,和
previousButton 儿童JSpinner。
|
protected Component |
createNextButton()
创建一个增量按钮,即
|
protected Component |
createPreviousButton()
创建一个递减按钮,即
|
static ComponentUI |
createUI(JComponent c)
返回一个新的实例synthspinnerui。
|
SynthContext |
getContext(JComponent c)
返回指定组件的上下文。
|
protected void |
installDefaults()
初始化
JSpinner
border ,
foreground ,和
background ,基于相应的“微调性质。*”属性的缺省值表。
|
protected void |
installListeners()
一个共享对象代表有趣的propertychangeevents保护方法初始化
PropertyChangeListener 。
|
void |
paint(Graphics g, JComponent c)
根据外观和感觉绘制指定的组件。
|
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)
被
PropertyChangeListener 当
JSpinner 编辑属性的变化。
|
protected void |
uninstallDefaults()
设置为空,
JSpinner's 布局管理器。
|
protected void |
uninstallListeners()
删除
PropertyChangeListener 补充installlisteners。
|
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
补充installlisteners。
这种方法被称为uninstallUI
。
uninstallListeners
方法重写,继承类
BasicSpinnerUI
BasicSpinnerUI.installListeners()
protected void installDefaults()
JSpinner
border
,
foreground
,和
background
,基于相应的“微调性质。*”属性的缺省值表。的
JSpinners
布局设置为返回的值
createLayout
。这种方法被称为
installUI
。
protected void uninstallDefaults()
JSpinner's
布局管理器。这种方法被称为
uninstallUI
。
protected LayoutManager createLayout()
LayoutManager
管理
editor
,
nextButton
,和JSpinner
previousButton
儿童。这三个孩子必须添加一个约束,确定他们的角色:“编辑”,“下一步”,和“以前”。默认的布局管理器可以处理这些孩子中的任何一个。
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()
。子类可以重写
createEditor
返回组件包含飞旋的编辑器或null,如果他们要处理添加编辑在
installUI
重写
JSpinner
。
通常这种方法会重写一个自定义边框容器包装的编辑,因为一个不能假设的边界可以直接编辑。
的replaceEditor
时调用的方法是改变JSpinner.setEditor
纺纱编辑。如果你重写这个方法,那么你可能会想重写replaceEditor
以及。
createEditor
方法重写,继承类
BasicSpinnerUI
BasicSpinnerUI.installUI(javax.swing.JComponent)
,
replaceEditor(javax.swing.JComponent, javax.swing.JComponent)
,
JSpinner.getEditor()
protected void replaceEditor(JComponent oldEditor, JComponent newEditor)
PropertyChangeListener
当
JSpinner
编辑属性的变化。删除旧编辑器并添加新的一个方法是这个方法的责任。默认情况下,此操作是:
删除(oldeditor)旋转;旋转。(neweditor,添加“编辑”);
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)
方法。
在一般情况下,该方法不需要由子类重写。所有的外观和感觉的渲染代码应该在paint
方法。
update
方法重写,继承类
ComponentUI
g
用于绘画的
Graphics
对象
c
被画的成分
paint(SynthContext,Graphics)
public void paint(Graphics g, JComponent c)
这种方法不使用Synth外观。绘画是由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对象描述事件源和性质已经改变。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.