javax.swing
Class DefaultListCellRenderer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLabel
                  extended by javax.swing.DefaultListCellRenderer
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ListCellRenderer, SwingConstants
Direct Known Subclasses:
DefaultListCellRenderer.UIResource, MetalFileChooserUI.FileRenderer, MetalFileChooserUI.FilterComboBoxRenderer

public class DefaultListCellRenderer
extends JLabel
implements ListCellRenderer, Serializable

The default implementation ListCellRenderer. It provides a standard renderer for data objects of all types via Object.toString().

See Also:
Serialized Form

Nested Class Summary
static class DefaultListCellRenderer.UIResource
          Subclasses DefaultListCellRenderers and implements UIResource.
 
Nested classes/interfaces inherited from class javax.swing.JLabel
JLabel.AccessibleJLabel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected static Border noFocusBorder
          This border is used whenever renderer doesn't have a focus.
 
Fields inherited from class javax.swing.JLabel
labelFor
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DefaultListCellRenderer()
           
 
Method Summary
 void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
          Fires a property change for a primitive boolean property.
 void firePropertyChange(String propertyName, byte oldValue, byte newValue)
          Report a change in a bound property to any registered property listeners.
 void firePropertyChange(String propertyName, char oldValue, char newValue)
          Report a change in a bound property to any registered property listeners.
 void firePropertyChange(String propertyName, double oldValue, double newValue)
          Report a change in a bound property to any registered property listeners.
 void firePropertyChange(String propertyName, float oldValue, float newValue)
          Report a change in a bound property to any registered property listeners.
 void firePropertyChange(String propertyName, int oldValue, int newValue)
          Fires a property change for a primitive integer property.
 void firePropertyChange(String propertyName, long oldValue, long newValue)
          Report a change in a bound property to any registered property listeners.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Report a change in a bound property to any registered property listeners.
 void firePropertyChange(String propertyName, short oldValue, short newValue)
          Report a change in a bound property to any registered property listeners.
 Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
          getListCellRendererComponent
 void repaint(long tm, int x, int y, int w, int h)
          Mark the described region of this component as dirty in the current RepaintManager.
 void repaint(Rectangle rect)
          Mark the described region of this component as dirty in the current RepaintManager.
 void revalidate()
          Queue a an invalidation and revalidation of this component, using RepaintManager.addInvalidComponent(javax.swing.JComponent).
 void validate()
          Re-lays out the components in this container.
 
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, setFont, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
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, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validateTree
 
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, getFontMetrics, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

noFocusBorder

protected static Border noFocusBorder
This border is used whenever renderer doesn't have a focus.

Constructor Detail

DefaultListCellRenderer

public DefaultListCellRenderer()
Method Detail

getListCellRendererComponent

public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus)
getListCellRendererComponent

Specified by:
getListCellRendererComponent in interface ListCellRenderer
Parameters:
list - JList list for the 'value'
value - object that should be rendered in the cell
index - index of the cell
isSelected - draw cell highlighted if isSelected is true
cellHasFocus - draw focus rectangle around cell if the cell has focus
Returns:
Component that will be painted to the desired cell.

validate

public void validate()
Description copied from class: Container
Re-lays out the components in this container.

Overrides:
validate in class Container
See Also:
Component.invalidate(), Component.doLayout(), LayoutManager, Container.validate()

revalidate

public void revalidate()
Description copied from class: JComponent
Queue a an invalidation and revalidation of this component, using RepaintManager.addInvalidComponent(javax.swing.JComponent).

Overrides:
revalidate in class JComponent

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int w,
                    int h)
Description copied from class: JComponent
Mark the described region of this component as dirty in the current RepaintManager. This will queue an asynchronous repaint using the system painting thread in the near future.

Overrides:
repaint in class JComponent
Parameters:
tm - ignored
x - coordinate of the region to mark as dirty
y - coordinate of the region to mark as dirty
w - dimension of the region to mark as dirty
h - dimension of the region to mark as dirty
See Also:
Component.update(Graphics)

repaint

public void repaint(Rectangle rect)
Description copied from class: JComponent
Mark the described region of this component as dirty in the current RepaintManager. This will queue an asynchronous repaint using the system painting thread in the near future.

Overrides:
repaint in class JComponent
Parameters:
rect - The rectangle to mark as dirty

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)
Description copied from class: Component
Report a change in a bound property to any registered property listeners.

Overrides:
firePropertyChange in class Component
Parameters:
propertyName - the property that changed
oldValue - the old property value
newValue - the new property value

firePropertyChange

public void firePropertyChange(String propertyName,
                               byte oldValue,
                               byte newValue)
Description copied from class: Component
Report a change in a bound property to any registered property listeners.

Overrides:
firePropertyChange in class Component
Parameters:
propertyName - the property that changed
oldValue - the old property value
newValue - the new property value

firePropertyChange

public void firePropertyChange(String propertyName,
                               char oldValue,
                               char newValue)
Description copied from class: Component
Report a change in a bound property to any registered property listeners.

Overrides:
firePropertyChange in class Component
Parameters:
propertyName - the property that changed
oldValue - the old property value
newValue - the new property value

firePropertyChange

public void firePropertyChange(String propertyName,
                               short oldValue,
                               short newValue)
Description copied from class: Component
Report a change in a bound property to any registered property listeners.

Overrides:
firePropertyChange in class Component
Parameters:
propertyName - the property that changed
oldValue - the old property value
newValue - the new property value

firePropertyChange

public void firePropertyChange(String propertyName,
                               int oldValue,
                               int newValue)
Description copied from class: JComponent
Fires a property change for a primitive integer property.

Overrides:
firePropertyChange in class JComponent
Parameters:
propertyName - the name of the property
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public void firePropertyChange(String propertyName,
                               long oldValue,
                               long newValue)
Description copied from class: Component
Report a change in a bound property to any registered property listeners.

Overrides:
firePropertyChange in class Component
Parameters:
propertyName - the property that changed
oldValue - the old property value
newValue - the new property value

firePropertyChange

public void firePropertyChange(String propertyName,
                               float oldValue,
                               float newValue)
Description copied from class: Component
Report a change in a bound property to any registered property listeners.

Overrides:
firePropertyChange in class Component
Parameters:
propertyName - the property that changed
oldValue - the old property value
newValue - the new property value

firePropertyChange

public void firePropertyChange(String propertyName,
                               double oldValue,
                               double newValue)
Description copied from class: Component
Report a change in a bound property to any registered property listeners.

Overrides:
firePropertyChange in class Component
Parameters:
propertyName - the property that changed
oldValue - the old property value
newValue - the new property value

firePropertyChange

public void firePropertyChange(String propertyName,
                               boolean oldValue,
                               boolean newValue)
Description copied from class: JComponent
Fires a property change for a primitive boolean property.

Overrides:
firePropertyChange in class JComponent
Parameters:
propertyName - the name of the property
oldValue - the old value of the property
newValue - the new value of the property