创建Shell窗体生成的代码?

hhsjwxh 2010-06-07 06:59:45
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;


public class dsafsdf extends Shell {

/**
* Launch the application
* @param args
*/
public static void main(String args[]) {
try {
Display display = Display.getDefault();
dsafsdf shell = new dsafsdf(display, SWT.SHELL_TRIM);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
} catch (Exception e) {
e.printStackTrace();
}
}

/**
* Create the shell
* @param display
* @param style
*/
public dsafsdf(Display display, int style) {
super(display, style);
createContents();
}

/**
* Create contents of the window
*/
protected void createContents() {
setText("SWT Application");
setSize(500, 375);
//
}

@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}

}
===================================================================

以上是创建可视化Shell窗体自动生成的代码!!和我以前手写不一样!!有的地方不是很理解!!请帮我加注释解释下... 越详细越好!!非常感谢!!!!
...全文
109 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

62,620

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧