📄 sashform1.java
字号:
package cn.com.chengang.swt;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class SashForm1 {
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(327, 253);
// ---------创建窗口中的其他界面组件-------------
SashForm sashForm = new SashForm(shell, SWT.NONE);// 定义一个分割窗容器
// 在SashForm容器中创建三个文本框,默认是按从左到右的顺序依次排列
Text text1 = new Text(sashForm, SWT.BORDER);
text1.setText("左");
new Text(sashForm, SWT.BORDER).setText("中");// 简洁写法
new Text(sashForm, SWT.BORDER).setText("右");
// 设置分割窗中各栏的宽度比例,左:中:右=3:1:2
sashForm.setWeights(new int[] { 3, 1, 2 });
sashForm.setBounds(10, 10, 206, 168);
// -----------------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 + -