eclipse 我可以检测 SWT 中文本字段的变化吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11653247/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I detect change in text fields in SWT?
提问by noMAD
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.
我有几个 SWT 小部件。如果存在的任何字段有任何修改,我将尝试创建一个操作。
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.
示例:如果我更改名称,Text
我应该能够识别它。我尝试在网上搜索解决方案,但找不到合适的解决方案。
Any suggestions?
有什么建议?
回答by Baldrick
ModifyListener listener = new ModifyListener() {
/** {@inheritDoc} */
public void modifyText(ModifyEvent e) {
// Handle event
}
});
text1.addModifyListener(listener);
text2.addModifyListener(listener);