import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; public class GetTableItemSize { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setSize(0, 0); Table table = new Table(shell, SWT.NONE); table.setSize(0, 0); TableItem tableItem = new TableItem(table, SWT.NONE); System.out.println("TableItem bounds with shell (0, 0), table (0, 0): " + tableItem.getBounds()); System.out .println("Get item at tableItem center point with shell (0, 0), table (0, 0): " + table.getItem(centerPoint(tableItem.getBounds()))); table.setSize(100, 100); System.out .println("TableItem bounds with shell (0, 0), table (100, 100): " + tableItem.getBounds()); System.out .println("Get item at tableItem center point with shell (0, 0), table (100, 100): " + table.getItem(centerPoint(tableItem.getBounds()))); } private static Point centerPoint(Rectangle boundingRectangle) { return new Point(boundingRectangle.x + boundingRectangle.width / 2, boundingRectangle.y + boundingRectangle.height / 2); } }