Don't understand defaultCellEditor for Float values
843805Nov 24 2006 — edited Nov 27 2006I have a JTable which has a column of float values. The column class is set to Float, and the (simplified) getValueAt method looks like this:
public Object getValueAt(int row, int col) {
return new Float(floatValues[row]);
}
The getColumnClass method returns a Float.
The defaultCellEditor works OK, except that if the column entry contains a single zero, for instance, and you click on the cell or move to the cell using hte cursor keys, then if you type a 1, the value displayed becomes "0.01". If you type ".1", the n it displays "0.0.1", which requires futher editing. The only way around it is to delete or highlight the existing values before entering.
Is there a way to change this behaviour without writing a custom cell editor? It seems the default behaviour isn't right, unless I've missed something obvious.