有意义就是好好活,好好活就是做有意义的事情!是什么使我不由自主的仰望星空?

[原创]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:D pY
  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 lfry y*`
   public void mouseDoubleClick(MouseEvent e)ITPUB个人空间 ZI5L0}'k.N
   {
?M FX5iL7D0    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!E B
  shell.layout();ITPUB个人空间wz3y tl0\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:

飞仙遨游的记事本 引用 删除 ysfabm   /   2007-12-14 15:46:25
原帖由tiantian911于2007-12-14 10:47:01发表
为什么我没有eclipse的包呢。。


你指的什么包???
Lucy有话讲 引用 删除 tiantian911   /   2007-12-14 10:47:01
为什么我没有eclipse的包呢。。
yangsufeng的个人空间 引用 删除 yangsufeng   /   2007-12-13 15:49:20
333
 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar