📄 helloworld.java
字号:
package com.swtdesigner;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;
public class HelloWorld {
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(327, 253);
shell.setText("SWT Application");
//------------------新插入的界面核心代码------------------------
Text text = new Text(shell, SWT.BORDER); //新建一个text对象
text.setText("HelloWorld"); //给text文本框设置初始文字HelloWorld
text.setBounds(88, 94, 100, 25); //设置文本框的位置和大小,(x轴坐标,y轴坐标,宽度,高度)
//------------------END---------------------------------------------
shell.layout();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -