uic.widgets
Class TwoColorCellRenderer

java.lang.Object
  extended by uic.widgets.TwoColorCellRenderer
All Implemented Interfaces:
TableCellRenderer

public class TwoColorCellRenderer
extends Object
implements TableCellRenderer

Implementation of a table cell renderer that has different colors for the odd and even table rows


Field Summary
protected  TableCellRenderer baseRenderer
           
 
Constructor Summary
TwoColorCellRenderer()
           
TwoColorCellRenderer(TableCellRenderer baseRender)
          Constructor needed to wrap the standard table cell renderer
 
Method Summary
 Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
          Returns the visible component
 boolean isPaintFocus()
          Should focus rectangle be painted?
 void setEvenRowColor(Color bg2)
          Sets the color for the even row (rowcount starts at 0) Because of a bug in jdk1.3 Color.white cannot be used as a row color when a different odd color is used
 void setOddRowColor(Color bg)
          Sets the color for the odd row (rowcount starts at 0) Because of a bug in jdk1.3 Color.white cannot be used as a row color when a different even color is used
 void setPaintFocus(boolean paintFocus)
          Should focus rectangle be painted?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseRenderer

protected TableCellRenderer baseRenderer
Constructor Detail

TwoColorCellRenderer

public TwoColorCellRenderer()

TwoColorCellRenderer

public TwoColorCellRenderer(TableCellRenderer baseRender)
Constructor needed to wrap the standard table cell renderer

Method Detail

getTableCellRendererComponent

public Component getTableCellRendererComponent(JTable table,
                                               Object value,
                                               boolean isSelected,
                                               boolean hasFocus,
                                               int row,
                                               int column)
Returns the visible component

Specified by:
getTableCellRendererComponent in interface TableCellRenderer

setOddRowColor

public void setOddRowColor(Color bg)
Sets the color for the odd row (rowcount starts at 0) Because of a bug in jdk1.3 Color.white cannot be used as a row color when a different even color is used


setEvenRowColor

public void setEvenRowColor(Color bg2)
Sets the color for the even row (rowcount starts at 0) Because of a bug in jdk1.3 Color.white cannot be used as a row color when a different odd color is used


setPaintFocus

public void setPaintFocus(boolean paintFocus)
Should focus rectangle be painted?

Parameters:
paintFocus - true if focus rectangle should be painted

isPaintFocus

public boolean isPaintFocus()
Should focus rectangle be painted?

Returns:
true if focus rectangle should be painted


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