import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.Accessible;
import org.eclipse.swt.accessibility.AccessibleControlAdapter;
import org.eclipse.swt.accessibility.AccessibleControlEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class AccessibleControlListenerAdding {
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Label label = new Label(shell, SWT.NONE);
label.setText("asdf");
Accessible accessible = label.getAccessible();
accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
public void getState(AccessibleControlEvent e) {
super.getState(e);
System.out.println("AccessibleControlListener");
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
|