Quick question. I have text in a JFormattedTextField, I clear it with a clear button to make it setText(""); and heres the problem:

When I go back in the field, and just to test it, I just tab out or mouse click out of it without typing anything in it, and for some reason, the text that was in there before I cleared it to setText("") reappears. I have the LostFocus stuff and GainFocus method already in there for a bunch of textFields.

Has anyone come across this before?

By default, in Swing, <TAB> means give focus to next component

I understand that, but I don't think that helps me here. I clear text, go back to the field and press tab without entering any new text, and automatically the text that was in there before clearing the field reappears, even though I cleared it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.