Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table.styles
Class DefaultStyle

java.lang.Object
  extended by com.citra.table.styles.DefaultStyle
All Implemented Interfaces:
Style

public class DefaultStyle
extends Object
implements Style

DefaultStyle is a Style implementation that paints alternate rows of a table with different colors.


Field Summary
protected  Color evenColor
          the background color for even rows
protected  Color oddColor
          the background color for odd rows
 
Constructor Summary
DefaultStyle()
          Constructs a DefaultStyle.
DefaultStyle(Color oddColor, Color evenColor)
          Constructs a DefaultStyle.
 
Method Summary
 void apply(Component c, JTable table, int row, int column)
          Applies the style to the component c.
 Color getEvenColor()
          Returns the color used to paint the even rows of the table.
 Color getOddColor()
          Returns the color used to paint the odd rows of the table.
 void setEvenColor(Color evenColor)
          Sets the color for painting the even rows of the table.
 void setOddColor(Color oddColor)
          Sets the color for painting the odd rows of the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oddColor

protected Color oddColor
the background color for odd rows


evenColor

protected Color evenColor
the background color for even rows

Constructor Detail

DefaultStyle

public DefaultStyle()
Constructs a DefaultStyle.


DefaultStyle

public DefaultStyle(Color oddColor,
                    Color evenColor)
Constructs a DefaultStyle.

Method Detail

apply

public void apply(Component c,
                  JTable table,
                  int row,
                  int column)
Applies the style to the component c.

Specified by:
apply in interface Style
Parameters:
c - the component that we wish to apply a style to.
table - the associated table
row - the current row of the table
column - the current column of the table

getEvenColor

public Color getEvenColor()
Returns the color used to paint the even rows of the table.

Returns:
the even row color

getOddColor

public Color getOddColor()
Returns the color used to paint the odd rows of the table.

Returns:
the odd row color

setEvenColor

public void setEvenColor(Color evenColor)
Sets the color for painting the even rows of the table.

Parameters:
evenColor - the even row color

setOddColor

public void setOddColor(Color oddColor)
Sets the color for painting the odd rows of the table.

Parameters:
oddColor - the odd row color

Copyright © 2011 Citra Technologies. All Rights Reserved.