javax.swing.table

Class DefaultTableCellRenderer

public class DefaultTableCellRenderer extends JLabel implements TableCellRenderer, Serializable

Class to display every cells.
Nested Class Summary
static classDefaultTableCellRenderer.UIResource
Field Summary
protected static BordernoFocusBorder
Constructor Summary
DefaultTableCellRenderer()
Creates a default table cell renderer with an empty border.
Method Summary
protected voidfirePropertyChange(String propertyName, Object oldValue, Object newValue)
Overriden for performance.
voidfirePropertyChange(String propertyName, boolean oldValue, boolean newValue)
Overriden for performance.
ComponentgetTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
Get the string value of the object and pass it to setText().
booleanisOpaque()
Overriden for performance.
voidrepaint(long tm, int x, int y, int width, int height)
Overriden for performance.
voidrepaint(Rectangle r)
Overriden for performance.
voidrevalidate()
voidsetBackground(Color c)
Assign the unselected-background.
voidsetForeground(Color c)
Assign the unselected-foreground.
protected voidsetValue(Object value)
Sets the String for this cell.
voidupdateUI()
Look and feel has changed.
voidvalidate()
Overriden for performance.

Field Detail

noFocusBorder

protected static Border noFocusBorder

Constructor Detail

DefaultTableCellRenderer

public DefaultTableCellRenderer()
Creates a default table cell renderer with an empty border.

Method Detail

firePropertyChange

protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
Overriden for performance.

This method needs to be overridden in a subclass to actually do something.

firePropertyChange

public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
Overriden for performance.

This method needs to be overridden in a subclass to actually do something.

getTableCellRendererComponent

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
Get the string value of the object and pass it to setText().

Parameters: table the JTable value the value of the object. For the text content, null is rendered as an empty cell. isSelected is the cell selected? hasFocus has the cell the focus? row the row to render column the cell to render

Returns: this component (the default table cell renderer)

isOpaque

public boolean isOpaque()
Overriden for performance.

This method needs to be overridden in a subclass to actually do something.

Returns: always true

repaint

public void repaint(long tm, int x, int y, int width, int height)
Overriden for performance.

This method needs to be overridden in a subclass to actually do something.

repaint

public void repaint(Rectangle r)
Overriden for performance.

This method needs to be overridden in a subclass to actually do something.

revalidate

public void revalidate()

setBackground

public void setBackground(Color c)
Assign the unselected-background.

Parameters: c the color to assign

setForeground

public void setForeground(Color c)
Assign the unselected-foreground.

Parameters: c the color to assign

setValue

protected void setValue(Object value)
Sets the String for this cell.

Parameters: value the string value for this cell; if value is null it sets the text value to an empty string

updateUI

public void updateUI()
Look and feel has changed.

Replaces the current UI object with the latest version from the UIManager.

validate

public void validate()
Overriden for performance.

This method needs to be overridden in a subclass to actually do something.