开发者

Java SWT User Input Validation

What is the Java convention when it comes to user input validation in SWT? I read that there are FieldEditors which are very convenient fields but sadly only for preferences and dialogue boxes.

I also read that there is an IValidator interface. But it is often used with data binding, which is in my case, most of my inputs do not need any data binding yet. Also, IValidator requires me to write my own validation methods even for simple validations such as integer only, letters only, etc.

Since the F开发者_运维百科ieldEditors cannot be applied in normal usage of input fields, what other convenient way can I use to do validation on user inputs? I am using SWT for my Java GUI.

Thanks!


You can validate the input of your control in a VerifyListener. See this forum thread for further explanation.

Alternatively, you can check out RCP Toolbox which has a built-in easy-to-use validation framework. See this article.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜