What you need is a document listener. With it you can get notifications for all the changes in the document and you can execute your validation code there. Heres one example which calls the validate() which will contain the actual validation code.
Originally posted by RaviSingh Kumar: Want to validate the textfield as soon as some invalid text is entered. for e.g. If is EmpID field, error message is shown as soon as some non-integer value is entered.
I had tried it to validate once the whole form is submitted,but unable to provide solution for the above situation.
Please provide appropriate steps for this. The application is in Swing
Originally posted by Brian Cole: Calling DefaultFormatter.setAllowsInvalid(false) would prevent the user from typing invalid input at all, which is a bit different from allowing it but showing an error message.