java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ComboBoxUI
javax.swing.plaf.basic.BasicComboBoxUI
javax.swing.plaf.synth.SynthComboBoxUI
- 所有已实现的接口:
-
PropertyChangeListener,EventListener,SynthConstants,SynthUI
为
JComboBox提供Synth外观UI代理。
- 自从:
- 1.7
-
Nested Class Summary
Nested classes/interfaces declared in class javax.swing.plaf.basic.BasicComboBoxUI
BasicComboBoxUI.ComboBoxLayoutManager, BasicComboBoxUI.FocusHandler, BasicComboBoxUI.ItemHandler, BasicComboBoxUI.KeyHandler, BasicComboBoxUI.ListDataHandler, BasicComboBoxUI.PropertyChangeHandler -
Field Summary
Fields declared in class javax.swing.plaf.basic.BasicComboBoxUI
arrowButton, cachedMinimumSize, comboBox, currentValuePane, editor, focusListener, hasFocus, isMinimumSizeDirty, itemListener, keyListener, listBox, listDataListener, padding, popup, popupKeyListener, popupMouseListener, popupMouseMotionListener, propertyChangeListener, squareButtonFields declared in interface javax.swing.plaf.synth.SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentUI为给定的组件创建一个新的UI对象。返回指定组件的上下文。protected Dimension使用当前渲染器和字体返回组合框空显示区域的默认大小。最小大小是显示区域的大小加上插图再加上按钮。void适当地为外观配置指定的组件。voidpaint(Graphics g, JComponent c) 根据外观绘制指定的组件。protected voidpaint(SynthContext context, Graphics g) 绘制指定的组件。voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) 绘制边框。voidpaintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) 绘制当前选定的项目。void当绑定属性更改时调用此方法。voidupdate(Graphics g, JComponent c) 通知此UI代理重新绘制指定的组件。Methods declared in class javax.swing.plaf.basic.BasicComboBoxUI
addEditor, configureArrowButton, configureEditor, createArrowButton, createEditor, createFocusListener, createItemListener, createKeyListener, createLayoutManager, createListDataListener, createPopup, createPropertyChangeListener, createRenderer, getBaseline, getBaselineResizeBehavior, getDisplaySize, getInsets, getSizeForComponent, installComponents, installDefaults, installKeyboardActions, installListeners, isFocusTraversable, isNavigationKey, isPopupVisible, paintCurrentValueBackground, rectangleForCurrentValue, removeEditor, selectNextPossibleValue, selectPreviousPossibleValue, setPopupVisible, toggleOpenClose, unconfigureArrowButton, unconfigureEditor, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListenersMethods declared in class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getPreferredSize, uninstallUI
-
Constructor Details
-
SynthComboBoxUI
public SynthComboBoxUI()构造一个SynthComboBoxUI。
-
-
Method Details
-
createUI
为给定的组件创建一个新的UI对象。- 参数:
-
c- 要为其创建UI对象的组件 - 返回:
- UI对象
-
installUI
适当地为外观配置指定的组件。当将ComponentUI实例安装为指定组件上的UI代理时,将调用此方法。此方法应完全为外观配置组件,包括以下内容:- 在组件上安装默认属性值,如颜色、字体、边框、图标、不透明度等。尽可能地,由客户端程序初始化的属性值不应被覆盖。
- 如有必要,在组件上安装
LayoutManager。 - 为组件创建/添加任何必需的子组件。
- 在组件上创建/安装事件监听器。
- 在组件上创建/安装
PropertyChangeListener,以便适当地检测和响应组件属性更改。 - 在组件上安装键盘UI(助记键、遍历等)。
- 初始化任何适当的实例数据。
- 覆盖:
-
installUI在类ComponentUI中 - 参数:
-
c- 正在安装此UI代理的组件 - 参见:
-
getContext
返回指定组件的上下文。- 指定者:
-
getContext在接口SynthUI中 - 参数:
-
c- 请求SynthContext的组件 - 返回:
- 描述组件的SynthContext
-
propertyChange
当绑定属性更改时调用此方法。- 指定者:
-
propertyChange在接口PropertyChangeListener中 - 参数:
-
e- 描述事件源和已更改属性的PropertyChangeEvent对象
-
update
通知此UI代理重新绘制指定的组件。此方法绘制组件背景,然后调用paint(SynthContext,Graphics)方法。一般来说,子类不需要覆盖此方法。所有外观渲染代码应位于
paint方法中。- 覆盖:
-
update在类ComponentUI中 - 参数:
-
g- 用于绘制的Graphics对象 -
c- 正在绘制的组件 - 参见:
-
getMinimumSize
最小大小是显示区域的大小加上插图再加上按钮。- 覆盖:
-
getMinimumSize在类BasicComboBoxUI中 - 参数:
-
c- 正在查询其最小大小的组件;此参数通常被忽略,但如果UI对象是无状态的并且由多个组件共享,则可能会使用 - 返回:
-
一个
Dimension对象或null - 参见:
-
paint
根据外观绘制指定的组件。此方法不被Synth外观使用。绘制由
paint(SynthContext,Graphics)方法处理。- 覆盖:
-
paint在类ComponentUI中 - 参数:
-
g- 用于绘制的Graphics对象 -
c- 正在绘制的组件 - 参见:
-
paint
绘制指定的组件。- 参数:
-
context- 正在绘制的组件的上下文 -
g- 用于绘制的Graphics对象 - 参见:
-
paintBorder
绘制边框。- 指定者:
-
paintBorder在接口SynthUI中 - 参数:
-
context- 一个组件上下文 -
g- 用于绘制的Graphics -
x- X坐标 -
y- Y坐标 -
w- 边框的宽度 -
h- 边框的高度
-
paintCurrentValue
绘制当前选定的项目。- 覆盖:
-
paintCurrentValue在类BasicComboBoxUI中 - 参数:
-
g- 一个Graphics实例 -
bounds- 要渲染到的边界矩形 -
hasFocus- 是否聚焦
-
getDefaultSize
使用当前渲染器和字体返回组合框空显示区域的默认大小。此方法已被覆盖,以在计算组合框大小时使用SynthComboBoxRenderer而不是DefaultListCellRenderer作为默认渲染器。这在组合框没有任何数据的情况下使用。- 覆盖:
-
getDefaultSize在类BasicComboBoxUI中 - 返回:
- 空显示区域的大小
- 参见:
-