【Java开源代码栏目提醒】:网学会员为需要Java开源代码的朋友们搜集整理了ApplicationWindow1.java相关资料,希望对各位网友有所帮助!
package cn.com.chengang.jface;
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 ApplicationWindow1 extends ApplicationWindow {
public static void main(String[] args) {
new ApplicationWindow1(null).run();
}
public ApplicationWindow1(Shell parentShell) {
super(parentShell);
// 不可调整窗口大小,只有关闭钮,窗口保持在最前面。可以参考Shell的式样
setShellStyle(SWT.DIALOG_TRIM | SWT.ON_TOP);
}
//窗口的执行方法
public void run() {
setBlockOnOpen(true);//true指在执行open方法时,程序暂停往下执行
open();
Display.getCurrent().dispose();
}
//覆盖自父类的方法,在其中创建窗口中的组件
protected Control createContents(Composite parent) {
getShell().setText("ApplicationWindow窗口");
parent.setSize(200, 100);
Label label = new Label(parent, SWT.CENTER);
label.setText("大家好");
return parent;
}
}
上一篇:
ApplicationException.java
下一篇:
首鼠两端