Big problem with JFormattedTextField.

When I use a JFormattedTextField to receive on input just letters when the JFormattedTextField loses focus it just clear the field! Why that?

try{

MaskFormatter mask =new MaskFormatter("?");

mask.setValidCharacters("abcdefghijklmnopqrstuvxwyzABCDEFGHIJKLMNOPQRSTUVXWYZ");

nameText =new JFormattedTextField(mask);

}

catch(ParseException pe){

}

When the JTextFormattedTextField loses the focus it gets empty. Why?

And I have another important question: Besides letters, I need to receive empty spaces on my JFormattetTextField. How can I set this on setValidCharacters method?

Thanks!

[942 byte] By [coffee95a] at [2007-11-27 1:41:34]
# 1

You should be displaying a message when you handle an Exception.

If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.

camickra at 2007-7-12 0:57:07 > top of Java-index,Desktop,Core GUI APIs...