posted 18 years ago
For what it's worth ...
I have corrected the problem of my JTable cells containing the wrong data types by instantiating a DefaultTableCellRenderer for each of the columns that will contain numbers. But floats, doubles, and integers are still left-aligned after the data is entered into the cell (although the cursor appears on the right-hand side of the cell prior to editing), and any cell whose class is Number.class is still not editable.
As an experiment, I tried creating a JTable and populating it with initial values. Again, I overrode the getColumnClass method to return Number.class, Float.class, and Integer.class for certain columns. In each case, the values are right-aligned. Also, the float and integer values can be edited, but cells of class Number are still not editable.
Does anybody know why I can't edit Numbers? Is this normal for JTables, or could it be something in my code? Thanks for your help.