📄 sashform1.java
字号:
/**
* @作者:陈刚
* @Email:glchengang@yeah.net
* @Blog:http://blog.csdn.net/glchengang
*/
package 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);
shell.setText("SWT Application");
//------------------新插入的界面核心代码------------------------
SashForm sashForm = new SashForm(shell, SWT.NONE);//定义一个分割窗容器
/* 在sashForm在创建三个文本框,默认是按左右顺序依次排列 */
Text text_1 = new Text(sashForm, SWT.BORDER); //在sashForm容器上创建一个Text
text_1.setText("左");
//再创建两个文本框。这是将两个语句合成一语来写的简洁写法。
new Text(sashForm, SWT.BORDER).setText("中");
new Text(sashForm, SWT.BORDER).setText("右");
//setWeights方法设置了sashForm中各栏的宽度比例-左:中:右=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();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -