table.jvt

来自「SWT_designer安装软件」· JVT 代码 · 共 42 行

JVT
42
字号
import
org.eclipse.swt.SWT
org.eclipse.swt.layout.FillLayout
org.eclipse.swt.widgets.Display
org.eclipse.swt.widgets.Shell
org.eclipse.swt.widgets.Table
org.eclipse.swt.widgets.TableColumn

method
	public static void main(String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell();
		shell.setLayout(new FillLayout());
		shell.setText("Table test");
		{
			final Table table = new Table(shell, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION | SWT.MULTI);
			table.setLinesVisible(true);
			table.setHeaderVisible(true);
			{
				final TableColumn tableColumn = new TableColumn(table, SWT.NONE);
				tableColumn.setWidth(100);
				tableColumn.setText("First column");
			}
			{
				final TableColumn tableColumn = new TableColumn(table, SWT.CENTER);
				tableColumn.setWidth(200);
				tableColumn.setText("Center column");
			}
			{
				final TableColumn tableColumn = new TableColumn(table, SWT.RIGHT);
				tableColumn.setWidth(150);
				tableColumn.setText("Right column");
			}
		}
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?