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
|
public class RendererJCheckBox extends org.jvnet.substance.SubstanceDefaultTableCellRenderer {
/**
* Renderer pour les cases à cocher.
*/
public RendererJCheckBox() {
super();
super.setHorizontalAlignment(CENTER);
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.setHorizontalAlignment(CENTER);
Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
JCheckBox ch = new JCheckBox();
ch.setHorizontalAlignment(CENTER);
if(value.toString().equals("true"))
ch.setSelected(true);
else
ch.setSelected(false);
ch.setBackground(cell.getBackground());
return ch;
}
} |
Partager