我可以在swt中检测文本字段的变化吗? [英] Can I detect change in text fields in swt?

查看:115
本文介绍了我可以在swt中检测文本字段的变化吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个 swt 小部件。如果存在任何字段中的任何修改,我正在尝试创建一个操作。例如,如果我从 Text 中更改名称,我应该能够识别它。我尝试在线搜索解决方案,但找不到合适的解决方案。任何建议?

I have a couple of swt widgets. I am trying to create an action if there is any modification in any of the fields present. Example, if I change the name from the Text I should be able to identify it. I tried searching online for a solution but couldn't find a suitable one. Any suggestions?

推荐答案

使用 addModifyListener

ModifyListener listener = new ModifyListener() {
    /** {@inheritDoc} */
    public void modifyText(ModifyEvent e) {
        // Handle event
    }
});

text1.addModifyListener(listener);
text2.addModifyListener(listener);

这篇关于我可以在swt中检测文本字段的变化吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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