I'm trying to extend the JTextField class to a JNumField subclass in which only numeric key-in would be accepted. This is probably a very common problem, but I could not find a simple solution to it yet.
I tried with a MaskFormatter, as explained here (see pjstroh's message) but encountered problems when trying to compile the code.
Solved. The problem was that I adding the key listener from within the init() function which is -I assume- called only for applets. As my class is not an applet, the init() function was not called. I can now catch key events as I moved addKeyListener(this) in the class constructor.
_________________ Please recommend my post if you found it helpful