⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grid.jvt

📁 SWT_designer安装软件
💻 JVT
字号:
import
org.eclipse.swt.SWT
org.eclipse.swt.layout.GridData
org.eclipse.swt.layout.GridLayout
org.eclipse.swt.widgets.Button
org.eclipse.swt.widgets.Composite
org.eclipse.swt.widgets.Display
org.eclipse.swt.widgets.Group
org.eclipse.swt.widgets.Label
org.eclipse.swt.widgets.Shell
org.eclipse.swt.widgets.Text

method
	public static void main(String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell();
		final GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 3;
		shell.setLayout(gridLayout);
		shell.setText("GridLayout test");
		{
			final Label label = new Label(shell, SWT.NONE);
			final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
			gridData.horizontalSpan = 3;
			label.setLayoutData(gridData);
			label.setText("label");
		}
		{
			final Text text = new Text(shell, SWT.BORDER);
			final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
			gridData.horizontalSpan = 3;
			text.setLayoutData(gridData);
			text.setText("horizontalSpan = 3 Text");
		}
		{
			final Group group = new Group(shell, SWT.NONE);
			group.setText("Left group");
			group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
		}
		{
			final Composite composite = new Composite(shell, SWT.NONE);
			composite.setLayout(new GridLayout());
			composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
			{
				final Button button = new Button(composite, SWT.NONE);
				button.setLayoutData(new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_END));
				button.setText("button");
			}
			{
				final Button button = new Button(composite, SWT.NONE);
				button.setLayoutData(new GridData());
				button.setText("button");
			}
			{
				final Button button = new Button(composite, SWT.NONE);
				button.setLayoutData(new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING));
				button.setText("button");
			}
		}
		{
			final Group group = new Group(shell, SWT.NONE);
			group.setText("Right group");
			group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
		}
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

⌨️ 快捷键说明

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