boosta,
Are you limited to a text based interface? I mean why not a visual calendar control?
I just googled "java calendar control" and came up with http://builder.com.com/5100-6370-1045263.html and http://www.toedter.com/en/jcalendar/ on the first page...
If you must use a JTextField you'll need to use EventListener(s) to filter keyboard input... I've never tried it... I've never had to.... and if this is not specific stated requirement then I'd drop it like a gun.
I (like many other users) hate fancy custom interfaces which don't behave as you expect... and I (like many other users) am just to lazy to RTFM.
keith.
If you're going to be looking at what the user keys into the JTextField then you should be using a DocumentListener and not mucking about looking at keystrokes. The DocumentListener abstracts out the keystrokes (including paste and backspace and so on) and just shows you what changed.
However you can't edit a date by looking at the keystrokes. You can't tell whether a string is a valid date until you have the entire string. For example if the user has keyed in "02/29/201" then that will be valid if the next character input is "2" or "6" but invalid otherwise.