testenv.java
来自「SWT 基础编程源码」· Java 代码 · 共 45 行
JAVA
45 行
package com.jixy.baseOnSWT;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class TestEnv {
private static Text helloworldText;
/**
* Launch the application
*
* @param args
*/
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell jixy_shell = new Shell();
jixy_shell.setSize(500, 375);
jixy_shell.setText("SWT Application");
//TODO add some parameter
// TableViewer tv;
jixy_shell.open();
System.out.println("hello, SWT world!");
final Composite composite = new Composite(jixy_shell, SWT.NONE);
composite.setBounds(0, 10, 100, 26);
helloworldText = new Text(composite, SWT.BORDER);
helloworldText.setBounds(0, 0,80, 25);
helloworldText.setText("HelloWorld");
jixy_shell.layout();
while (!jixy_shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?