I'm having trouble displaying Date in the format I want in my JTable . My JTable was created using ResultSet and lists.
I tried the following in getValueAt(.) But no luck:
if(value instanceof Date) { //System.out.println("isDate"); DateFormat formatter = DateFormat.getDateInstance(); SimpleDateFormat f = new SimpleDateFormat("MM/dd/yy"); value = f.format(value); Date parsed = (Date) value; try { parsed = (Date) f.parse(value.toString()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } value = parsed.toString(); }
println(.) never prints, so it doesn't even get to that. Display format Apr 10, 1992 but I want 04/10/92
While we are on the Date topic in JTables ... I have isCellEditable(.) As true, but I cannot edit Date cells. How do you do this?
source share