public class SynthComboBoxUI extends BasicComboBoxUI implements PropertyChangeListener, SynthUI
JComboBox
。
BasicComboBoxUI.ComboBoxLayoutManager, BasicComboBoxUI.FocusHandler, BasicComboBoxUI.ItemHandler, BasicComboBoxUI.KeyHandler, BasicComboBoxUI.ListDataHandler, BasicComboBoxUI.PropertyChangeHandler
arrowButton, cachedMinimumSize, comboBox, currentValuePane, editor, focusListener, hasFocus, isMinimumSizeDirty, itemListener, keyListener, listBox, listDataListener, padding, popup, popupKeyListener, popupMouseListener, popupMouseMotionListener, propertyChangeListener, squareButton
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
Constructor and Description |
---|
SynthComboBoxUI() |
Modifier and Type | Method and Description |
---|---|
protected JButton |
createArrowButton()
创建一个按钮可显示或隐藏的组合框弹出部分的控制。
|
protected ComboBoxEditor |
createEditor()
创建默认的编辑器,用于编辑组合框。
|
protected ComboPopup |
createPopup()
创建组合框弹出的部分。
|
protected ListCellRenderer |
createRenderer()
创建默认的渲染器,将用于非editiable组合框。
|
static ComponentUI |
createUI(JComponent c)
为给定组件创建一个新的用户界面对象。
|
SynthContext |
getContext(JComponent c)
返回指定组件的上下文。
|
protected Dimension |
getDefaultSize()
返回默认大小空显示区域的组合框使用当前渲染器和字体。
|
protected void |
installDefaults()
安装默认的颜色,默认字体,默认渲染器,默认编辑器为JComboBox。
|
protected void |
installListeners()
创建和安装组合框的侦听器和它的模型。
|
void |
installUI(JComponent c)
配置指定的组件适当的外观和感觉。
|
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 |
paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
绘制当前选定的项目。
|
void |
propertyChange(PropertyChangeEvent e)
当改变绑定属性时,这种方法会被调用。
|
protected void |
uninstallDefaults()
卸载默认的颜色,默认字体,默认的渲染器,并从组合框的默认编辑器。
|
protected void |
uninstallListeners()
从组合框中移除已安装的侦听器和它的模型。
|
void |
uninstallUI(JComponent c)
逆转形态,完成指定的组件在
installUI 。
|
void |
update(Graphics g, JComponent c)
通知这个UI代理重新绘制指定的组件。
|
addEditor, configureArrowButton, configureEditor, createFocusListener, createItemListener, createKeyListener, createLayoutManager, createListDataListener, createPropertyChangeListener, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getDisplaySize, getInsets, getMaximumSize, getMinimumSize, getPreferredSize, getSizeForComponent, installComponents, installKeyboardActions, isFocusTraversable, isNavigationKey, isPopupVisible, paintCurrentValueBackground, rectangleForCurrentValue, removeEditor, selectNextPossibleValue, selectPreviousPossibleValue, setPopupVisible, toggleOpenClose, unconfigureArrowButton, unconfigureEditor, uninstallComponents, uninstallKeyboardActions
contains
public static ComponentUI createUI(JComponent c)
c
-组件创建UI对象
public void installUI(JComponent c)
ComponentUI
实例被安装在指定组件的UI代理。这种方法应该完全配置的组件外观和感觉,包括以下内容:
LayoutManager
组件上的必要。PropertyChangeListener
变化适当。installUI
方法重写,继承类
BasicComboBoxUI
c
-组件,UI代理被安装
ComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
protected void installDefaults()
BasicComboBoxUI
installDefaults
方法重写,继承类
BasicComboBoxUI
protected void installListeners()
installListeners
方法重写,继承类
BasicComboBoxUI
public void uninstallUI(JComponent c)
installUI
。这个方法被调用时,这个
UIComponent
实例被作为指定组件的UI代理删除。这种方法应该撤消配置进行
installUI
,小心留下的
JComponent
实例在干净的状态(没有多余的听众,外观和感觉的特定属性的对象,等)。这应包括以下几个方面:
uninstallUI
方法重写,继承类
BasicComboBoxUI
c
-从这个UI代理被删除的组件;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
ComponentUI.installUI(javax.swing.JComponent)
,
JComponent.updateUI()
protected void uninstallDefaults()
uninstallDefaults
方法重写,继承类
BasicComboBoxUI
protected void uninstallListeners()
installListeners
uninstallListeners
方法重写,继承类
BasicComboBoxUI
public SynthContext getContext(JComponent c)
getContext
接口
SynthUI
c
组件请求synthcontext。
protected ComboPopup createPopup()
createPopup
方法重写,继承类
BasicComboBoxUI
ComboPopup
实例
ComboPopup
protected ListCellRenderer createRenderer()
setRenderer
使用。
createRenderer
方法重写,继承类
BasicComboBoxUI
ListCellRender
JComboBox.setRenderer(javax.swing.ListCellRenderer<? super E>)
protected ComboBoxEditor createEditor()
setEditor
使用。
createEditor
方法重写,继承类
BasicComboBoxUI
ComboBoxEditor
JComboBox.setEditor(javax.swing.ComboBoxEditor)
public void propertyChange(PropertyChangeEvent e)
propertyChange
接口
PropertyChangeListener
e
- PropertyChangeEvent对象描述事件源和性质已经改变。
protected JButton createArrowButton()
createArrowButton
方法重写,继承类
BasicComboBoxUI
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
方法重写,继承类
BasicComboBoxUI
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 paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
paintCurrentValue
方法重写,继承类
BasicComboBoxUI
protected Dimension getDefaultSize()
getDefaultSize
方法重写,继承类
BasicComboBoxUI
BasicComboBoxUI.getDisplaySize()
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.