Can I detect change in text fields in SWT?

徘徊边缘 提交于 2020-01-03 06:50:10

问题


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?


回答1:


Use addModifyListener

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

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


来源:https://stackoverflow.com/questions/11653247/can-i-detect-change-in-text-fields-in-swt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!