Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I detect change in text fields in SWT?

Tags:

java

eclipse

swt

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?

like image 697
noMAD Avatar asked Jul 25 '12 15:07

noMAD


1 Answers

Use addModifyListener

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

text1.addModifyListener(listener);
text2.addModifyListener(listener);
like image 195
Baldrick Avatar answered Sep 30 '22 00:09

Baldrick