Does anybody knows which the best pratice for validate the input information in a JTextField???
Is there a component free for this validation???
Have a look at JFormattedTextField, it can validate input data
Also check the following article
it shows how to create RegexFormatter which allows using regular expressions for validation
If you dont want to use JFormattedTextField you can subclass PlainDocument class which would validate data using regexp or whatever and set it to your textfields
see JTextField in javadoc for example
and JTextField.setDocument(Document doc)
In addition to JFormattedTextField and a custom PlainDocument you could
also create a custom DocumentFilter. While DocumentFilter was primarily
designed for JFTF it can be used on it's one. Creating a custom
DocumentFilter is a bit lighter weight than creating a custom Document.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.