here is my cell renderer code.I want to add a Jprogressbar in a column and update its value from outside.
But till now i couldnt update the value of the bar.
Moreover when i select a row the corresponding Jprogressbar's appearence changes.
Please help.
public class tableprogressColumn extends JProgressBar implements TableCellRenderer {
private JTable table;
public tableprogressColumn(JTable table,int column,int max) {
super(0,max);
setBorderPainted (false);
setStringPainted (true);
this.table=table;
this.setIndeterminate(true);
TableColumnModel columnModel=table.getColumnModel();
columnModel.getColumn(column).setCellRenderer(this );
this.setValue(80);
this.setForeground(new Color(255,10,10));
}
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus,
int row, int column) {
setBackground (table.getBackground ());
if(value!=null)
setValue(((Integer)value).intValue());
return this;
}
public boolean isDisplayable() {
return true;
}
}