I have a problem with JFormattedTextField, namely keeping it in non-overwrite mode. I learned how to set it to non-rewriting, namely using setOverwriteMode (false).
However, although this function allows me to enter a field without overwriting, when the focus is lost and I enter the field again, overWriteMode turns on again!
Is there a way to keep overWriteMode false? I would prefer a solution that does not set it to false every time I lose focus, but if this is the only possible solution, so be it.
This is what I have now:
DefaultFormatter format = new DefaultFormatter(); format.setOverwriteMode(false); inputField = new JFormattedTextField(); inputField.setValue("don't overwrite this!"); inputField.setColumns(20); format.install(inputField);
I hope someone can help me!
Solution proposed by Robin:
DefaultFormatter format = new DefaultFormatter(); format.setOverwriteMode(false); inputField = new JFormattedTextField(format);
Thanks for the help! Relations
source share