Search code examples
javaswingjtabletablecellrenderertablecelleditor

How to make Swing jTable cell show Date object in "YY-MM-DD" format in both view and inline edit states?


I'm able to display dates in my custom dateformat (my cell renderer) but when inline editing starts in cell, date format is changed to for example "Tue Feb 14 00:00:00 CET 2012". This is nice if it comes to presentation but to input a date.

How to show & edit dates in "YY-MM-DD" format in all Date cells in every state?


Solution

  • TableCellRenderer is for viewing, Try overwriting TableCellEditor

    Here few examples you can find for CellEditor Concepts: Editors and Renderers