package jpianotrain.gui;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import jpianotrain.staff.Chord;
import jpianotrain.staff.Note;
public class VLTableCellRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent(JTable table,
Object val,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
if (val instanceof Note) {
Note n=(Note)val;
return super.getTableCellRendererComponent(table,
n.getName(),
isSelected,
hasFocus,
row,
column);
} else if (val instanceof Chord) {
Chord c=(Chord)val;
return super.getTableCellRendererComponent(table,
c.toShortString(),
isSelected,
hasFocus,
row,
column);
} else {
return super.getTableCellRendererComponent(table,
val,
isSelected,
hasFocus,
row,
column);
}
}
}