- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JLabel
-
- javax.swing.DefaultListCellRenderer
-
- All Implemented Interfaces:
-
ImageObserver
,MenuContainer
,Serializable
,Accessible
,ListCellRenderer<Object>
,SwingConstants
- 已知直接子类:
-
DefaultListCellRenderer.UIResource
,MetalFileChooserUI.FileRenderer
,MetalFileChooserUI.FilterComboBoxRenderer
public class DefaultListCellRenderer extends JLabel implements ListCellRenderer<Object>, Serializable
渲染列表中的项目。Implementation Note:个该类覆盖
invalidate
,validate
,revalidate
,repaint
,isOpaque
,并firePropertyChange
只是为了提高性能。 如果不被覆盖,这些经常被称为的方法将执行默认列表单元格渲染器不必要的代码路径。 如果您编写自己的渲染器,请注意重写这些方法的优点和缺点。警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4版本开始,支持所有JavaBeans的长期存储已被添加到
java.beans
软件包中。 请参阅XMLEncoder
。- 从以下版本开始:
- 1.2
- 另请参见:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 描述 static class
DefaultListCellRenderer.UIResource
实现UIResource的DefaultListCellRenderer的子类。-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class javax.swing.JLabel
JLabel.AccessibleJLabel
-
-
Field Summary
Fields Modifier and Type Field 描述 protected static Border
noFocusBorder
没有焦点边界-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from interface 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
-
-
构造方法摘要
构造方法 Constructor 描述 DefaultListCellRenderer()
为列表中的项构造一个默认渲染器对象。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 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)
由于性能原因而被覆盖。void
firePropertyChange(String propertyName, short oldValue, short newValue)
由于性能原因而被覆盖。protected void
firePropertyChange(String propertyName, Object oldValue, Object 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()
由于性能原因而被覆盖。-
Methods inherited from class 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class 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, transferFocusDownCycle, validateTree
-
Methods inherited from class 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
-
Methods inherited from class 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
-
-
-
-
字段详细信息
-
noFocusBorder
protected static Border noFocusBorder
没有焦点边界
-
-
方法详细信息
-
getListCellRendererComponent
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus)
描述从接口ListCellRenderer
复制返回已配置为显示指定值的组件。 然后调用该组件的paint
方法“渲染”单元。 如果有必要计算列表的维度,因为列表单元格不具有固定的大小,则调用此方法来生成可以调用其的组件,其中可以调用getPreferredSize
。- Specified by:
-
getListCellRendererComponent
在接口ListCellRenderer<Object>
- 参数
-
list
- 我们正在画的JList。 -
value
- 由list.getModel()返回的值。getElementAt(index)。 -
index
- 细胞指数。 -
isSelected
- 如果指定的单元格被选中,isSelected
真。 -
cellHasFocus
- 如果指定的单元格具有焦点,cellHasFocus
真。 - 结果
- 其paint()方法将呈现指定值的组件。
- 另请参见:
-
JList
,ListSelectionModel
,ListModel
-
isOpaque
public boolean isOpaque()
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
isOpaque
在JComponent
- 结果
-
true
如果背景完全不透明,并且与JList的背景不同; 否则为false
- 从以下版本开始:
- 1.5
- 另请参见:
-
JComponent.setOpaque(boolean)
-
validate
public void validate()
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。
-
invalidate
public void invalidate()
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
invalidate
在Container
- 从以下版本开始:
- 1.5
- 另请参见:
-
Container.validate()
,Container.layout()
,LayoutManager2
-
repaint
public void repaint()
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
repaint
在Component
- 从以下版本开始:
- 1.5
- 另请参见:
-
Component.update(Graphics)
-
revalidate
public void revalidate()
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。
-
repaint
public void repaint(long tm, int x, int y, int width, int height)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
repaint
在JComponent
- 参数
-
tm
- 不使用此参数 -
x
- 脏区域的x值 -
y
- 脏区域的y值 -
width
- 脏区域的宽度 -
height
- 脏区域的高度 - 另请参见:
-
JComponent.isPaintingOrigin()
,Component.isShowing()
,RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)
-
repaint
public void repaint(Rectangle r)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
repaint
在JComponent
- 参数
-
r
- 一个包含脏区域的Rectangle
- 另请参见:
-
JComponent.isPaintingOrigin()
,Component.isShowing()
,RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)
-
firePropertyChange
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
firePropertyChange
在Component
- 参数
-
propertyName
- 其值已更改的属性 -
oldValue
- 该物业的以前的价值 -
newValue
- 该物业的新价值
-
firePropertyChange
public void firePropertyChange(String propertyName, byte oldValue, byte newValue)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
firePropertyChange
在Component
- 参数
-
propertyName
- 已更改的属性的编程名称 -
oldValue
- 属性的旧值(作为一个字节) -
newValue
- 属性的新值(作为一个字节) - 另请参见:
-
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
-
firePropertyChange
public void firePropertyChange(String propertyName, char oldValue, char newValue)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
firePropertyChange
在JComponent
- 参数
-
propertyName
- 已更改的属性的编程名称 -
oldValue
- 属性的旧值(作为char) -
newValue
- 属性的新值(作为char) - 另请参见:
-
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
-
firePropertyChange
public void firePropertyChange(String propertyName, short oldValue, short newValue)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
firePropertyChange
在Component
- 参数
-
propertyName
- 已更改的属性的编程名称 -
oldValue
- 物业的旧价值(作为短期) -
newValue
- 物业的新价值(作为短期) - 另请参见:
-
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
-
firePropertyChange
public void firePropertyChange(String propertyName, int oldValue, int newValue)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
firePropertyChange
在JComponent
- 参数
-
propertyName
- 其值已更改的属性 -
oldValue
- 该物业的以前的价值 -
newValue
- 房产的新值
-
firePropertyChange
public void firePropertyChange(String propertyName, long oldValue, long newValue)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
firePropertyChange
在Component
- 参数
-
propertyName
- 已更改的属性的编程名称 -
oldValue
- 属性的旧值(长) -
newValue
- 物业的新价值(长期) - 另请参见:
-
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
-
firePropertyChange
public void firePropertyChange(String propertyName, float oldValue, float newValue)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
firePropertyChange
在Component
- 参数
-
propertyName
- 已更改的属性的编程名称 -
oldValue
- 该属性的旧值(作为浮点数) -
newValue
- 属性的新值(作为浮点数) - 另请参见:
-
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
-
firePropertyChange
public void firePropertyChange(String propertyName, double oldValue, double newValue)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
firePropertyChange
在Component
- 参数
-
propertyName
- 已更改的属性的编程名称 -
oldValue
- 该属性的旧值(双重) -
newValue
- 该属性的新值(双重) - 另请参见:
-
Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
-
firePropertyChange
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
由于性能原因而被覆盖。 有关详细信息,请参阅Implementation Note 。- 重写:
-
firePropertyChange
在JComponent
- 参数
-
propertyName
- 其值已更改的属性 -
oldValue
- 该物业的以前的价值 -
newValue
- 该物业的新价值
-
-