import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; public class NoWiggleNeeded { Display display; void run() { display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); List list = new List(shell, SWT.NONE); list.add("item 1"); shell.setSize(200, 200); shell.open(); flushEvents(); Point point = list.toDisplay(20, 5); int x = point.x; int y = point.y; System.out.println("posting mouse move..."); //$NON-NLS-1$ Event event = new Event(); event.type = SWT.MouseMove; event.x = x; event.y = y; display.post(event); System.out.println("posted"); //$NON-NLS-1$ flushEvents(); System.out.println("posting mouse down..."); //$NON-NLS-1$ event = new Event(); event.type = SWT.MouseDown; event.button = 1; display.post(event); System.out.println("posted"); //$NON-NLS-1$ flushEvents(); System.out.println("posting mouse up..."); //$NON-NLS-1$ event = new Event(); event.type = SWT.MouseUp; event.button = 1; display.post(event); System.out.println("posted"); //$NON-NLS-1$ while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } private void flushEvents() { System.out.println("flushEvents start..."); //$NON-NLS-1$ while (display.readAndDispatch()); System.out.println("flushEvents done."); //$NON-NLS-1$ } public static void main(String[] args) { new NoWiggleNeeded().run(); } }