helloworld2.java
来自「Eclipse RCP应用系统开发方法与实战源代码」· Java 代码 · 共 50 行
JAVA
50 行
package rcpbook.swtjface.sample;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class HelloWorld2 extends ApplicationWindow {
public HelloWorld2() {
super(null);
}
public static void main(String args[]) {
try {
HelloWorld2 window = new HelloWorld2();
window.setBlockOnOpen(true);
window.open();
Display.getCurrent().dispose();
} catch (Exception e) {
e.printStackTrace();
}
}
protected void configureShell(Shell parent) {
parent.setText("Hello World!");
parent.setSize(500, 375);
}
protected Control createContents(Composite parent) {
//new Label(parent, SWT.BORDER).setText("This is a plain label.");
// Create a vertical separator
Label x=new Label(parent, SWT.SEPARATOR);
x.setSize(2,parent.getSize().y);
// Create a label with a border
//new Label(parent, SWT.BORDER).setText("This is a label with a border.");
// Create a horizontal separator
//Label separator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
return x;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?