⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helloworld2.java

📁 Eclipse RCP应用系统开发方法与实战源代码
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -