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

📄 columnlayout1.java

📁 SWTJFace篇项目源程序该项目包含 包含了Eclipse下构建swt的基本工程
💻 JAVA
字号:
package cn.com.chengang.form;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.widgets.ColumnLayout;
import org.eclipse.ui.forms.widgets.FormToolkit;

public class ColumnLayout1 {
	public static void main(String[] args) {
		final Display display = Display.getDefault();
		final Shell shell = new Shell();
		shell.setSize(327, 253);
		// ---------创建窗口中的其他界面组件-------------
		shell.setLayout(new FillLayout());
		FormToolkit toolkit = new FormToolkit(display);
		Composite comp = toolkit.createComposite(shell);
		ColumnLayout layout = new ColumnLayout();
		// RowLayout layout = new RowLayout();
		// layout.maxNumColumns = 4;
		// layout.minNumColumns = 1;
		comp.setLayout(layout);
		toolkit.createButton(comp, "1", SWT.PUSH);
		toolkit.createButton(comp, "2", SWT.PUSH);
		toolkit.createButton(comp, "3", SWT.PUSH);
		toolkit.createButton(comp, "4", SWT.PUSH);
		toolkit.createButton(comp, "5", SWT.PUSH);
		toolkit.createButton(comp, "6", SWT.PUSH);
		toolkit.createButton(comp, "7", SWT.PUSH);
		toolkit.createButton(comp, "8", SWT.PUSH);
//		toolkit.createButton(comp, "9", SWT.PUSH);
//		toolkit.createButton(comp, "10", SWT.PUSH);
		//
		toolkit.paintBordersFor(comp);

		// -----------------END------------------------
		shell.layout();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}

⌨️ 快捷键说明

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