JFormattedTextField and nullFormatter

F

Francois

Hi

I need a DateFormatter which gives a zero length String in a JTextField
when receiving a null object and which gives null when the field is
emptied.
I tried:

JFormattedTextField.AbstractFormatterFactory fact = new
DefaultFormatterFactory(
(new DateFormatter(new SimpleDateFormat("dd-MM-yyyy"))),
(new DateFormatter(new SimpleDateFormat("dd-MM-yyyy"))),
(new DateFormatter(new SimpleDateFormat("yyyy-MM-dd"))),
(new DateFormatter(new SimpleDateFormat("yyyy-MM-dd")))
);

and
JFormattedTextField.AbstractFormatterFactory fact = new
DefaultFormatterFactory(
(new DateFormatter(new SimpleDateFormat("dd-MM-yyyy"))),
(new DateFormatter(new SimpleDateFormat("dd-MM-yyyy"))),
(new DateFormatter(new SimpleDateFormat("yyyy-MM-dd"))),
null
);
without success. How have I to do this ?

Thanks in advance !

Francois
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top