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.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; public class WiggleNeeded { Display display; void run() { display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); Table table = new Table(shell, SWT.NONE); TableItem item = new TableItem(table, SWT.NONE); item.setText("testMoveToValidItemSingleItem"); //$NON-NLS-1$ shell.setSize(200, 200); shell.open(); flushEvents(); Point point = table.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 WiggleNeeded().run(); } }