Storing strings in the table might be fast for rendering, but might be slow for 
sorting, as every value in the column might have to be parsed into a Date object (and 
possibly multiple times) during the sort.

How about just use a subclass of Date?  Have your subclass override toString() to 
format your date however you wish.  You could also cache the value you return from 
toString().

Joel

-----Original Message-----
From: Singh,Gary - PLANO [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 4:58 PM
To: 'Ruth Aguilar '
Cc: '[EMAIL PROTECTED]'
Subject: RE: Date Column in a JTable


 From the SimpleDateFormat class after formatting your date then you can
recovert your string back to Date by calling .parse.. method check java docs
for more info on this. This will return an object of the type Date.

Thanks and Regards,
Gary Grewal

-----Original Message-----
From: Ruth Aguilar
To: [EMAIL PROTECTED]
Sent: 6/20/01 9:33 AM
Subject: Date Column in a JTable

Hi,

I want to display in  a table column the Date data in complete way. For
example if I have "Fri Mar 09 18:25:00 GMT +01:00:00 2001", in the table
using Date class to define this column  I have "09-mars-01" what is
correct,
but I would like also to display the Time, something like this
"09-mars-01
18:25:00".

I can have something like that if I use the SimpleDateFormat class but
the
result is a string class  and not anymore a Date class.

Well, I don't want to change the class of the column, since I have the
option to sort the columns in the table.

suggestions?

Ruth 
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to