©
本文档使用 PHP中文网手册 发布
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JLabel javax.swing.DefaultListCellRenderer
public class DefaultListCellRenderer
呈现列表中的一个项。
实现注意事项: 此类重写 invalidate
、validate
、revalidate
、repaint
、isOpaque
和 firePropertyChange
只是为了提高性能。如果不重写这些方法,这些经常调用的方法将执行那些对于默认列表单元格渲染器不必要的代码路径。如果编写自己的渲染器,则要小心权衡重写这些方法的利弊。
警告:此类的序列化对象将与以后的 Swing 版本不兼容。当前的序列化支持适用于短期存储或运行相同 Swing 版本的应用程序之间的 RMI。从 1.4 版本开始,已在 java.beans
包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder
。
嵌套类摘要 | |
---|---|
static class |
DefaultListCellRenderer.UIResource
实现 UIResource 的 DefaultListCellRenderer 的子类。 |
从类 javax.swing.JLabel 继承的嵌套类/接口 |
---|
JLabel.AccessibleJLabel |
从类 javax.swing.JComponent 继承的嵌套类/接口 |
---|
JComponent.AccessibleJComponent |
从类 java.awt.Container 继承的嵌套类/接口 |
---|
Container.AccessibleAWTContainer |
从类 java.awt.Component 继承的嵌套类/接口 |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
字段摘要 | |
---|---|
protected static Border |
noFocusBorder
一个空 Border 。 |
从类 javax.swing.JLabel 继承的字段 |
---|
labelFor |
从类 javax.swing.JComponent 继承的字段 |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
从类 java.awt.Component 继承的字段 |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
从接口 javax.swing.SwingConstants 继承的字段 |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
从接口 java.awt.image.ImageObserver 继承的字段 |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
构造方法摘要 | |
---|---|
DefaultListCellRenderer()
为列表中的项构造默认渲染器对象。 |
方法摘要 | |
---|---|
void |
firePropertyChange(String propertyName,
boolean oldValue,
boolean newValue)
因为性能原因而被重写。 |
void |
firePropertyChange(String propertyName,
byte oldValue,
byte newValue)
因为性能原因而被重写。 |
void |
firePropertyChange(String propertyName,
char oldValue,
char newValue)
因为性能原因而被重写。 |
void |
firePropertyChange(String propertyName,
double oldValue,
double newValue)
因为性能原因而被重写。 |
void |
firePropertyChange(String propertyName,
float oldValue,
float newValue)
因为性能原因而被重写。 |
void |
firePropertyChange(String propertyName,
int oldValue,
int newValue)
因为性能原因而被重写。 |
void |
firePropertyChange(String propertyName,
long oldValue,
long newValue)
因为性能原因而被重写。 |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
因为性能原因而被重写。 |
void |
firePropertyChange(String propertyName,
short oldValue,
short newValue)
因为性能原因而被重写。 |
Component |
getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
返回已配置用于显示指定值的组件。 |
void |
invalidate()
因为性能原因而被重写。 |
boolean |
isOpaque()
因为性能原因而被重写。 |
void |
repaint()
因为性能原因而被重写。 |
void |
repaint(long tm,
int x,
int y,
int width,
int height)
因为性能原因而被重写。 |
void |
repaint(Rectangle r)
因为性能原因而被重写。 |
void |
revalidate()
因为性能原因而被重写。 |
void |
validate()
因为性能原因而被重写。 |
从类 javax.swing.JLabel 继承的方法 |
---|
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI |
从类 javax.swing.JComponent 继承的方法 |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
从类 java.awt.Container 继承的方法 |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validateTree |
从类 java.awt.Component 继承的方法 |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
字段详细信息 |
---|
protected static Border noFocusBorder
Border
。可以不使用此字段。要更改此渲染器所使用的 Border
,需要重写 getListCellRendererComponent
方法并直接设置返回组件的边框。
构造方法详细信息 |
---|
public DefaultListCellRenderer()
方法详细信息 |
---|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
ListCellRenderer
复制的描述paint
方法来“呈现”单元格。如果由于列表单元格没有固定的大小而有必要计算该列表的尺寸,则调用此方法来生成一个可在其上调用 getPreferredSize
的组件。
ListCellRenderer
中的 getListCellRendererComponent
list
- 正在绘制的 JList。value
- 由 list.getModel().getElementAt(index) 返回的值。index
- 单元格索引。isSelected
- 如果选择了指定的单元格,则为 true。cellHasFocus
- 如果指定的单元格拥有焦点,则为 true。
JList
,
ListSelectionModel
,
ListModel
public boolean isOpaque()
JComponent
中的 isOpaque
true
,否则返回 false
JComponent.setOpaque(boolean)
public void validate()
Container
中的 validate
Container.add(java.awt.Component)
,
Component.invalidate()
,
JComponent.revalidate()
,
Container.validateTree()
public void invalidate()
Container
中的 invalidate
Container.validate()
,
Container.layout()
,
LayoutManager
,
LayoutManager2.invalidateLayout(Container)
public void repaint()
Component
中的 repaint
Component.update(Graphics)
public void revalidate()
JComponent
中的 revalidate
Component.invalidate()
,
Container.validate()
,
JComponent.isValidateRoot()
,
RepaintManager.addInvalidComponent(javax.swing.JComponent)
public void repaint(long tm, int x, int y, int width, int height)
JComponent
中的 repaint
tm
- 不使用此参数x
- 脏区的 x 值y
- 脏区的 y 值width
- 脏区的宽度height
- 脏区的高度Component.isShowing()
,
RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)
public void repaint(Rectangle r)
JComponent
中的 repaint
r
- 包含脏区的 Rectangle
Component.isShowing()
,
RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
Component
中的 firePropertyChange
propertyName
- 其值已改变的属性oldValue
- 该属性以前的值newValue
- 该属性的新值public void firePropertyChange(String propertyName, byte oldValue, byte newValue)
Component
中的 firePropertyChange
propertyName
- 已改变的属性的编程名称oldValue
- 该属性的旧值(byte 类型)newValue
- 该属性的新值(byte 类型)Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
public void firePropertyChange(String propertyName, char oldValue, char newValue)
JComponent
中的 firePropertyChange
propertyName
- 已改变的属性的编程名称oldValue
- 该属性的旧值(char 类型)newValue
- 该属性的新值(char 类型)Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
public void firePropertyChange(String propertyName, short oldValue, short newValue)
Component
中的 firePropertyChange
propertyName
- 已改变的属性的编程名称oldValue
- 该属性的旧值(short 类型)newValue
- 该属性的新值(short 类型)Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
public void firePropertyChange(String propertyName, int oldValue, int newValue)
JComponent
中的 firePropertyChange
propertyName
- 其值已更改的属性oldValue
- 该属性以前的值newValue
- 该属性的新值public void firePropertyChange(String propertyName, long oldValue, long newValue)
Component
中的 firePropertyChange
propertyName
- 已改变的属性的编程名称oldValue
- 该属性的旧值(long 类型)newValue
- 该属性的新值(long 类型)Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
public void firePropertyChange(String propertyName, float oldValue, float newValue)
Component
中的 firePropertyChange
propertyName
- 已改变的属性的编程名称oldValue
- 该属性的旧值(float 类型)newValue
- 该属性的新值(float 类型)Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
public void firePropertyChange(String propertyName, double oldValue, double newValue)
Component
中的 firePropertyChange
propertyName
- 已改变的属性的编程名称oldValue
- 该属性的旧值(double 类型)newValue
- 该属性的新值(double 类型)Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
JComponent
中的 firePropertyChange
propertyName
- 其值已更改的属性oldValue
- 该属性以前的值newValue
- 该属性的新值
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。