JXDatePicker as table cell editor
Hi there everybody!
I've been doing some research trying to figure out the best way to do a date selection inside a table cell. Currently, my table is a normal JTable. I started out by trying a method involving a popup containing the JXMonthView component (as suggested by Kleopatra in some forum messages Google turned up). It came very, very close to working. The problem was mainly around the component losing focus and not being 'removed' when focus was lost. Then I tried to do a modal dialog such as the Oracle JTable example for the color chooser. That went OK -- but a modal dialog really wasn't what I was looking for. When undecorated, you can't tell that it's modal because nothing flashes when you try to force it to 'lose focus'. And when it's decorated, it looks really bad popping up a window just to change a date. I'm really hoping for a solution that acts like a normal cell editor. Then I tried popping a JXDatePicker into the JTable as a cell editor, but the borders are completely messed up and the text becomes unreadable when I try to edit the date.
Is there a 'best practice' for date editing within a table? Is the best approach to use JXTable? Does it handle the JXDatePicker better than the JTable seems to? Or is it possible to use JXDatePickers inside normal JTables with a bit of tweaking? I'd really appreciate some kind of guidance to help point me in the right direction. I feel like the problem I'm trying to solve must have been solved many times before. I just can't seem to find a nice clean solution to doing it 'properly'.