1. Create a utility to verify utill execution.
2. Verification Authentication Method
3. realize your logic
4. create an object of the utill class in which you want to use a test listener (in the text)
5.text.addverifylistener (utillclassobject)
Example: - 1. use the class: -
public class UtillVerifyListener implements VerifyListener { @Override public void verifyText(VerifyEvent e) {
2. using verifylistener in another class
public class TestVerifyListenerOne { public void createContents(Composite parent){ UtillVerifyListener listener=new UtillVerifyListener(); textOne = new Text(composite, SWT.BORDER); textOne .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textOne .addVerifyListener(listener) textTwo = new Text(composite, SWT.BORDER); textTwo .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textTwo .addVerifyListener(listener);
}}
source share