单击按钮时验证多个组件 [英] Validate more than one component on button click

查看:82
本文介绍了单击按钮时验证多个组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Swing(Java)准备的用户注册表,那么我该如何应用所有验证.就像我需要对名称进行验证,并只需单击一下按钮就无需移动电话.

I have a user registration form prepared in Swing (Java) So how can I apply validation all of them. Like I need a validation for the name and mobile no on one button click.

如何验证Swing中单击按钮时的多个组件?

How to validate more than one component on button click in Swing?

推荐答案

验证输入 ,每当尝试进行导航时,都可以使用InputVerifier来验证字段,从而无需使用特殊的验证按钮.如果需要,可以在按钮处理程序中调用完全没有副作用的verify()实现.

As shown in Validating Input, you can use InputVerifier to validate fields whenever an attempt is made to navigate, which obviates the need for a special validation button. If required, a verify() implementation that is correctly free of side effects may be invoked in a button handler.

这篇关于单击按钮时验证多个组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆