|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jcreme.swing.table.colormodel.DefaultTableColorModel
This a basic implementation of the TableColorModel interface. The only color effect of this class is to ensure a minimum "distance" between the foreground and background colors. Other implementations may derive from this class.
Field Summary | |
protected static int |
MINIMUM_COLOR_DISTANCE
This is the minimum "distance" between the background and the foreground colors. |
Constructor Summary | |
DefaultTableColorModel()
|
Method Summary | |
void |
addTableColorModelListener(TableColorModelListener l)
Enables to add listeners for the modifications of the color scheme. |
protected java.awt.Color |
ensureMinimumDistance(java.awt.Color fgColor,
java.awt.Color bgColor)
This method enables to generate a Color that may replace the parameter fgColor as a foreground Color. |
protected void |
fireTableColorModelChanged(TableColorModelEvent e)
Fires a TableColorModelEvent telling registered listeners that the color scheme has changed. |
java.awt.Color |
getBackgroundColor(int row,
int column,
boolean selected,
java.awt.Component renderer)
Gives access to the background color of a cell. |
protected int |
getDistance(java.awt.Color colorOne,
java.awt.Color colorTwo)
This method returns the "distance" between two colors. |
java.awt.Color |
getForegroundColor(int row,
int column,
boolean selected,
java.awt.Component renderer)
Gives access to the foreground color of a cell. |
java.util.EventListener[] |
getListeners(java.lang.Class listenerType)
Gets the list of the listeners registered for the modifications of the color scheme. |
javax.swing.table.TableModel |
getTableModel()
Gives access to the TableModel colored by this TableColorModel. |
protected java.awt.Color |
mixColors(java.awt.Color top,
java.awt.Color bottom)
This is a convenience method that enables to mix two colors. |
void |
removeTableColorModelListener(TableColorModelListener l)
Unregisters the listener for the modifications of the color model. |
void |
setTableModel(javax.swing.table.TableModel model)
Sets the model that will be colored by this TableColorModel. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int MINIMUM_COLOR_DISTANCE
Constructor Detail |
public DefaultTableColorModel()
Method Detail |
public java.util.EventListener[] getListeners(java.lang.Class listenerType)
getListeners
in interface TableColorModel
listenerType
- The class of listeners to retrieve.
public java.awt.Color getBackgroundColor(int row, int column, boolean selected, java.awt.Component renderer)
getBackgroundColor
in interface TableColorModel
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.
protected void fireTableColorModelChanged(TableColorModelEvent e)
e
- The event describing the changes.public void addTableColorModelListener(TableColorModelListener l)
addTableColorModelListener
in interface TableColorModel
l
- the listener to add.public void removeTableColorModelListener(TableColorModelListener l)
removeTableColorModelListener
in interface TableColorModel
l
- the listener to remove.public java.awt.Color getForegroundColor(int row, int column, boolean selected, java.awt.Component renderer)
getForegroundColor
in interface TableColorModel
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.
protected java.awt.Color ensureMinimumDistance(java.awt.Color fgColor, java.awt.Color bgColor)
fgColor
- the original foreground color.bgColor
- the original background color.
protected int getDistance(java.awt.Color colorOne, java.awt.Color colorTwo)
colorOne
- the first color.colorTwo
- the second color.
protected java.awt.Color mixColors(java.awt.Color top, java.awt.Color bottom)
top
- the color that is on the top layer.bottom
- the color that is on the bottom layer.
public javax.swing.table.TableModel getTableModel()
TableColorModel
getTableModel
in interface TableColorModel
TableColorModel.getTableModel()
public void setTableModel(javax.swing.table.TableModel model)
TableColorModel
setTableModel
in interface TableColorModel
model
- the data to be colored by this model.TableColorModel.setTableModel(javax.swing.table.TableModel)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |