JTable uses special format for Date?
I extended both TableModel and Date.
If I return the real class type of the date object in getColumnClass(), then the date gets formated like (mm dd, yyyy) and it never calles toString().
But if I say it's Object, it calles toString(), and correctly uses the format in the API, (dow mon dd hh:mm:ss zzz yyyy).
Anyone else seen similar problem?
So I'm having it lie in getColumnClass(), but still return the Date object in getValueAt(). And when I need to get the real class type I do so by calling getValueAt().getClass(), instead of using getColumnClass();
[590 byte] By [
luisa081a] at [2007-9-29 15:00:35]

The default cell renderers used by JTable is intelligent enough to render the data more appropriately based on the column classes returned by the table model. For e.g.
If your column is a number (Number), the renderer right aligns them.
If your column is date, it will be formatted using the default locale.
If your column is boolean a check box is showed instead of true, false.
If you want to override this behaviour, you need to create your own cell renderer and associate this renderer with desired object types.
Hope this helps
Sai Pullabhotla
psaia at 2007-7-15 5:59:06 >
