uic.widgets
Class TwoColorListCellRenderer

java.lang.Object
  extended by uic.widgets.TwoColorListCellRenderer
All Implemented Interfaces:
ListCellRenderer
Direct Known Subclasses:
FileChooser.FileFilterListCellRenderer

public class TwoColorListCellRenderer
extends Object
implements ListCellRenderer

CellRenderer for the list. Has to different colors for the odd and even rows to improve the look.


Constructor Summary
TwoColorListCellRenderer()
          Default constructor, same as new TwoColorListCellRenderer(null)
TwoColorListCellRenderer(ListCellRenderer renderer)
          Constructor based on an exisint cellrenderer
 
Method Summary
 Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
          Return the tweaked list cell renderer component
 boolean isPaintFocus()
           
 void setEvenRowColor(Color bg2)
          Set the even row color
 void setOddRowColor(Color bg)
          Set the odd row color
 void setPaintFocus(boolean paintFocus)
          Paint the focus if true
 void setSelectedBorder(Border border)
          Sets a border on the cell that should be used on selected entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwoColorListCellRenderer

public TwoColorListCellRenderer()
Default constructor, same as new TwoColorListCellRenderer(null)


TwoColorListCellRenderer

public TwoColorListCellRenderer(ListCellRenderer renderer)
Constructor based on an exisint cellrenderer

Parameters:
renderer - a cellrenderer that needs to be used for displaying listentries, or null if DefaultListCellRenderer can be used
Method Detail

getListCellRendererComponent

public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus)
Return the tweaked list cell renderer component

Specified by:
getListCellRendererComponent in interface ListCellRenderer

setSelectedBorder

public void setSelectedBorder(Border border)
Sets a border on the cell that should be used on selected entries.


setOddRowColor

public void setOddRowColor(Color bg)
Set the odd row color


setEvenRowColor

public void setEvenRowColor(Color bg2)
Set the even row color


setPaintFocus

public void setPaintFocus(boolean paintFocus)
Paint the focus if true


isPaintFocus

public boolean isPaintFocus()


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence