1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
public class TableIndividuCellRenderer extends JLabel implements TableCellRenderer {
private static final long serialVersionUID = 5197147479491609635L;
private static Color backgroundSelected = new Color(255, 255, 0);
/**
* Constructeur.
*/
public TableIndividuCellRenderer () {
super();
this.setFont(Constante.MONOSPACE);
this.setHorizontalAlignment(SwingConstants.CENTER);
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
if (isSelected) {
this.setOpaque(true);
this.setBackground(backgroundSelected);
} else {
this.setOpaque(false);
}
if (value != null) {
/*
* if(column == 0) { this.setText(arg0) } else {
*/
this.setText(value.toString());
// }
} else
this.setText("");
return this;
}
} |
Partager