有意义就是好好活,好好活就是做有意义的事情!是什么使我不由自主的仰望星空?
[原创]SWT程序设计的第一个程序
上一篇 /
下一篇 2007-12-12 13:15:31
/ 个人分类:Java开发技术
package com.swtdesigner;
import org.eclipse.jface.dialogs.MessageDialog;ITPUB个人空间bpFH|9t
import org.eclipse.swt.SWT;
b|5c|p-~{0import org.eclipse.swt.events.MouseAdapter;ITPUB个人空间'H
~[DWG
import org.eclipse.swt.events.MouseEvent;
a{PZs/U0import org.eclipse.swt.graphics.Image;ITPUB个人空间^i9fpdr r%W5I7]1Y
import org.eclipse.swt.widgets.Display;
|
W:be;h(M1p0import org.eclipse.swt.widgets.Shell;ITPUB个人空间b
Q"zd-^,O
import org.eclipse.swt.widgets.Text;
public class HelloWorld {
private static Text helloworldText;ITPUB个人空间5m8z%@I#K'JH4W
/**
&U2O1G
QP0 * Launch the application
|4B.S [/nv0qu,}^0 * @param argsITPUB个人空间
Qm}.w(k.d'f
*/ITPUB个人空间GimqC_g@-W/t4aQ^
public static void main(String[] args) {ITPUB个人空间6S9Y}1V
R
{f R
final Display display = Display.getDefault();ITPUB个人空间+Mnx1zY:DpY
final Shell shell = new Shell();ITPUB个人空间M)rn1x)WF
shell.setSize(500, 375);
l8iRd5HuD*E/H^0 shell.setText("我的第一个应用程序");
/_"?;ax$rQ0 Image image = new Image(Display.getCurrent(), "src/images/JavaCup.ico");ITPUB个人空间&pvxd @g9Fxo_
shell.setImage(image);
//ITPUB个人空间l;z
H3V6fi'nc
)Mh?JW0 shell.open();ITPUB个人空间6_d:q#u#A
helloworldText = new Text(shell, SWT.BORDER);ITPUB个人空间+`pg~f:N;LhA@A
helloworldText.addMouseListener(new MouseAdapter()
V)N0[S0Kf.GylZ0 {ITPUB个人空间b8X
lfryy*`
public void mouseDoubleClick(MouseEvent e)ITPUB个人空间ZI5L0}'k.N
{
?MFX5iL7D0 MessageDialog.openInformation(null,"","HelloWorld");ITPUB个人空间+B|0z@
WD)G
}ITPUB个人空间'y"X3zh(XN
});ITPUB个人空间"^}Z2Cv
helloworldText.setText("HelloWorld");ITPUB个人空间@M#Q/m]
g3H
helloworldText.setBounds(180, 125, 120, 30);ITPUB个人空间w
nZj!EB
shell.layout();ITPUB个人空间wz3ytl0\p
while (!shell.isDisposed()) {ITPUB个人空间F'L'B}&R$M!{t'iw
if (!display.readAndDispatch())ITPUB个人空间Gf"WVl)wm
display.sleep();
8~Yps [+\^$p0 }ITPUB个人空间
W,T\|`
}
}
3?5~(g'Z"Yec3D0
导入论坛
引用链接
收藏
分享给好友
推荐到圈子
管理
举报
TAG: