public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (value == null) {
//Render empty string when null
return super.getTableCellRendererComponent(table, null, isSelected, hasFocus, row, column);
}
TimeInterval timeInterval = (TimeInterval) value;
String stringRepresentation = timeInterval.toString(timeFormat==TimeFormat.DOUBLE);
if (drawGraphics) {
JLabel label = new JLabel();
Color background;
if (isSelected) {
background = SELECTED_BACKGROUND;
} else {
background = UNSELECTED_BACKGROUND;
}
final BufferedImage i = timeIntervalGraphics.createTimeIntervalImage(timeInterval.getLow(), timeInterval.getHigh(), table.getColumnModel().getColumn(column).getWidth() - 1, table.getRowHeight(row) - 1, FILL_COLOR, BORDER_COLOR, background);
label.setIcon(new ImageIcon(i));
label.setToolTipText(stringRepresentation);//String representation as tooltip
return label;
} else {
return super.getTableCellRendererComponent(table, stringRepresentation, isSelected, hasFocus, row, column);