import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; public class GetTableItemSize { public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(); shell.setSize(100, 100); final Table table = new Table(shell, SWT.NONE); table.setSize(15, 15); final TableItem tableItem = new TableItem(table, SWT.NONE); tableItem.setText("abc"); table.addListener(SWT.MouseDown, new Listener() { public void handleEvent(Event e) { System.out.println("\nShell bounds: " + shell.getBounds()); System.out.println("Table bounds: " + table.getBounds()); System.out.println("TableItem bounds: " + tableItem.getBounds()); System.out.println("Mouse point: " + new Point(e.x, e.y)); System.out.println("Item at mouse point: " + table.getItem(new Point(e.x, e.y))); System.out.println("TableItem center point: " + centerPoint(tableItem.getBounds())); System.out.println("Item at tableItem center point: " + table.getItem(centerPoint(tableItem.getBounds()))); } }); shell.addListener(SWT.MouseDown, new Listener() { public void handleEvent(Event e) { table.setSize(100, 100); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } private static Point centerPoint(Rectangle boundingRectangle) { return new Point(boundingRectangle.x + boundingRectangle.width / 2, boundingRectangle.y + boundingRectangle.height / 2); } }