JFormattedTextField, NumberFormatter etc.
Posted on 2003-12-11
Does anyone know how to set a formatter object on a JFormattedTextField (JFTF) *AFTER* it's created?? (without subclassing it?)
The JFTF is being constructed from an XML file parsed with a SAX parser; the way I implemented it, I really need (want) to call the default constructor in one method, and set it's attributes with another.
I can get the JFTF to work if I set the formatter in the constructor, but I simply don't have the attributes handy when I'm constructing it.
Well, actually I do, but I can use a really sweet algorithm if I could set the attributes after the JFTF is constructed.
setFormatter() is protected; JFormattedTextField.AbstractFormatter.install() isn't what I thought it was... The documentation is surprisingly limited, and I have yet to find an example where they don't set the formatter in the constructor.