org.jcreme.swing.table.colormodel
Class CyclingColorModel
java.lang.Object
org.jcreme.swing.table.colormodel.DefaultTableColorModel
org.jcreme.swing.table.colormodel.BaseCyclingColorModel
org.jcreme.swing.table.colormodel.CyclingColorModel
- All Implemented Interfaces:
- TableColorModel
- public class CyclingColorModel
- extends BaseCyclingColorModel
- implements TableColorModel
This class enables to give cycling colors to a Table. The cycle can have any
length desired and can contain any number of colors. An obvious use of this
ColorModel is to have a different color for every two or three lines to ease
the reading of the Table. This ColorModel implementation acts on lines rather
than on cells.
- Version:
- $Revision: 1.1 $
- Author:
- $Author: dbregeon $
|
Constructor Summary |
CyclingColorModel(java.awt.Color[] bgColors,
java.awt.Color[] fgColors,
java.awt.Color bgSelectedColor,
java.awt.Color fgSelectedColor,
int cycleLength)
Creates new CyclingColorModel |
|
Method Summary |
java.awt.Color |
getBackgroundColor(int row,
int column,
boolean selected,
java.awt.Component renderer)
Gives access to the background color of a cell. |
java.awt.Color |
getForegroundColor(int row,
int column,
boolean selected,
java.awt.Component renderer)
Gives access to the foreground color of a cell. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CyclingColorModel
public CyclingColorModel(java.awt.Color[] bgColors,
java.awt.Color[] fgColors,
java.awt.Color bgSelectedColor,
java.awt.Color fgSelectedColor,
int cycleLength)
- Creates new CyclingColorModel
- Parameters:
bgColors - the backgroud colors of the cycle.fgColors - the foreground colors of the cycle.bgSelectedColor - the background color for selected rows.fgSelectedColor - the foreground color for selected rows.cycleLength - the number of reps of the same color in the cycle.
getBackgroundColor
public java.awt.Color getBackgroundColor(int row,
int column,
boolean selected,
java.awt.Component renderer)
- Gives access to the background color of a cell.
- Specified by:
getBackgroundColor in interface TableColorModel- Overrides:
getBackgroundColor in class DefaultTableColorModel
- Parameters:
row - the cell's row.column - the cell's column.selected - whether the cell is currently selected or not.renderer - the renderer used to display the cell.
- Returns:
- the background color for the cell.
getForegroundColor
public java.awt.Color getForegroundColor(int row,
int column,
boolean selected,
java.awt.Component renderer)
- Gives access to the foreground color of a cell.
- Specified by:
getForegroundColor in interface TableColorModel- Overrides:
getForegroundColor in class DefaultTableColorModel
- Parameters:
row - the cell's row.column - the cell's column.selected - whether the cell is currently selected or not.renderer - the renderer used to display the cell.
- Returns:
- the foreground color for the cell.
Copyright 2006 null. All Rights Reserved.