15

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?

Lii
  • 11,553
  • 8
  • 64
  • 88
noMAD
  • 7,744
  • 19
  • 56
  • 94

1 Answers1

30

Use addModifyListener

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

text1.addModifyListener(listener);
text2.addModifyListener(listener);
Baldrick
  • 23,882
  • 6
  • 74
  • 79