- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ListUI
-
- javax.swing.plaf.basic.BasicListUI
-
- javax.swing.plaf.synth.SynthListUI
-
- All Implemented Interfaces:
-
PropertyChangeListener,EventListener,SynthConstants,SynthUI
public class SynthListUI extends BasicListUI implements PropertyChangeListener, SynthUI
为JList提供Synth L&F UI代表。- 从以下版本开始:
- 1.7
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicListUI
BasicListUI.FocusHandler, BasicListUI.ListDataHandler, BasicListUI.ListSelectionHandler, BasicListUI.MouseInputHandler, BasicListUI.PropertyChangeHandler
-
-
Field Summary
-
Fields inherited from class javax.swing.plaf.basic.BasicListUI
cellHeight, cellHeights, cellRendererChanged, cellWidth, fixedCellHeightChanged, fixedCellWidthChanged, focusListener, fontChanged, list, listDataListener, listSelectionListener, modelChanged, mouseInputListener, propertyChangeListener, prototypeCellValueChanged, rendererPane, selectionModelChanged, updateLayoutStateNeeded
-
Fields inherited from interface javax.swing.plaf.synth.SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
-
-
构造方法摘要
构造方法 Constructor 描述 SynthListUI()
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 static ComponentUIcreateUI(JComponent list)为给定的组件创建一个新的UI对象。SynthContextgetContext(JComponent c)返回指定组件的上下文。protected voidinstallDefaults()初始化字体,前景和背景等列表属性,并添加CellRendererPane。protected voidinstallListeners()创建并安装JList,其模型及其selectionModel的侦听器。voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)画边框voidpropertyChange(PropertyChangeEvent e)当绑定属性更改时,此方法将被调用。protected voiduninstallDefaults()将尚未被明确覆盖的列表属性设置为null。protected voiduninstallListeners()从JList,其模型及其selectionModel中移除侦听器。voidupdate(Graphics g, JComponent c)通知此UI代理重新绘制指定的组件。-
Methods inherited from class javax.swing.plaf.basic.BasicListUI
convertRowToY, convertYToRow, createFocusListener, createListDataListener, createListSelectionListener, createMouseInputListener, createPropertyChangeListener, getBaseline, getBaselineResizeBehavior, getCellBounds, getPreferredSize, getRowHeight, indexToLocation, installKeyboardActions, installUI, locationToIndex, maybeUpdateLayoutState, paint, paintCell, selectNextIndex, selectPreviousIndex, uninstallKeyboardActions, uninstallUI, updateLayoutState
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize
-
-
-
-
方法详细信息
-
createUI
public static ComponentUI createUI(JComponent list)
为给定的组件创建一个新的UI对象。- 参数
-
list- 为其创建UI对象的组件 - 结果
- UI对象
-
update
public void update(Graphics g, JComponent c)
通知此UI代理重新绘制指定的组件。 该方法描述了组件背景,然后调用BasicListUI.paint(java.awt.Graphics, javax.swing.JComponent)方法。通常,此方法不需要被子类覆盖。 所有的Look和Feel渲染代码都应该在
paint方法中。- 重写:
-
update在ComponentUI - 参数
-
g- 用于绘画的Graphics对象 -
c- 正在涂漆的组件 - 另请参见:
-
BasicListUI.paint(java.awt.Graphics, javax.swing.JComponent)
-
paintBorder
public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
画边框- Specified by:
-
paintBorder在接口SynthUI - 参数
-
context- 组件上下文 -
g-Graphics上画 -
x- X坐标 -
y- Y坐标 -
w- 边框的宽度 -
h- 边框的高度
-
installListeners
protected void installListeners()
创建并安装JList,其模型及其selectionModel的侦听器。 这个方法在installUI()时调用。
-
propertyChange
public void propertyChange(PropertyChangeEvent e)
当绑定属性更改时,此方法将被调用。- Specified by:
-
propertyChange在接口PropertyChangeListener - 参数
-
e- 描述事件源和已更改的属性的PropertyChangeEvent对象。
-
uninstallListeners
protected void uninstallListeners()
从JList,其模型及其selectionModel中移除侦听器。 所有的监听器字段都将重置为null。 这个方法在uninstallUI()时调用,它应该与installListeners保持同步。
-
installDefaults
protected void installDefaults()
初始化字体,前景和背景等列表属性,并添加CellRendererPane。 只有当当前值为null或UIResource时才会设置字体,前景和后台属性,如果当前值为空,则设置其他属性。
-
uninstallDefaults
protected void uninstallDefaults()
将未明确覆盖的列表属性设置为null。 如果某个属性的当前值不是UIResource则视为被覆盖。
-
getContext
public SynthContext getContext(JComponent c)
返回指定组件的上下文。- Specified by:
-
getContext在接口SynthUI - 参数
-
c- 组件请求SynthContext。 - 结果
- SynthContext描述组件。
-
-