1 /******************************************************************************* 2 * Copyright (c) 2018 Red Hat and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * Red Hat - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.swt.tests.gtk.snippets; 15 16 17 import org.eclipse.swt.SWT; 18 import org.eclipse.swt.layout.FillLayout; 19 import org.eclipse.swt.widgets.Display; 20 import org.eclipse.swt.widgets.Shell; 21 import org.eclipse.swt.widgets.Table; 22 import org.eclipse.swt.widgets.TableColumn; 23 import org.eclipse.swt.widgets.TableItem; 24 25 public class Bug457196_TableRightPaddingTest { 26 main(String[] a)27 public static void main(String[] a) { 28 Shell shell = new Shell(Display.getDefault()); 29 shell.setSize(200, 180); 30 shell.setLayout(new FillLayout()); 31 32 Table t = new Table(shell, SWT.BORDER); 33 t.setHeaderVisible(true); 34 35 TableColumn tc1 = new TableColumn(t, SWT.NONE); 36 TableColumn tc2 = new TableColumn(t, SWT.NONE); 37 tc1.setText("First Name"); 38 tc2.setText("Last Name"); 39 tc1.setWidth(70); 40 tc2.setWidth(70); 41 42 /*t.addListener(SWT.MeasureItem, new Listener() { 43 public void handleEvent(Event event) { 44 event.height = 30; 45 } 46 });*/ 47 48 new TableItem(t, SWT.NONE).setText(new String[] { "Tim", "Hatton" }); 49 new TableItem(t, SWT.NONE).setText(new String[] { "Caitlyn", "Warner" }); 50 51 shell.open(); 52 shell.layout(); 53 54 Display display = Display.getDefault(); 55 56 while (!shell.isDisposed()) { 57 if (!display.readAndDispatch()) { 58 display.sleep(); 59 } 60 } 61 62 display.dispose(); 63 } 64 } 65