问题描述
是否有一种简单的方法验证
Java中的一组
。我目前正在使用 JTextFields
sqlite manager
, neatbeans IDE
来创建一个简单的表单来收集信息以将作业添加到数据库中。我意识到JTextFields太多了。如何通过sqllite抛出可以自定义的异常错误,或者通过属性对话框在Neatbeans中验证每个JTextField。验证是存在检查,即已输入值。自定义验证消息?
Is there an easy way to validate
a group of JTextFields
in Java
. I am currently using sqlite manager
, neatbeans IDE
to create a simple form that collects information to add a job into the database. I realise there is too many JTextFields. How can I validate each JTextFields either through sqllite throwing an exception error which can be customised, or maybe in Neatbeans through properties dialogue box. Validation is to be presence check, i.e. has a value been entered. Custom validation message?
推荐答案
使用 InputVerifier
,如 >其他人。
Use an InputVerifier
, as shown in How to Use the Focus Subsystem : Validating Input. There's a related example here, among others.
这篇关于Java中JTextfield的表单验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!