当前位置:编程学习 > JAVA >>

java swt 不能弹出窗口

linux下用eclipse编译,为什么不能弹出窗口?
package chapter5;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class Hello
{
    /**
     * @param args
     */
    public static void main(String[] args)
    {
        // TODO Auto-generated method stub
        Display display=new Display();
        Shell shell=new Shell(display);
        shell.setText("Hello");
        shell.setSize(400,300);
        
        Text helloText=new Text(shell,SWT.CENTER);
        helloText.setText("Hello World!");
        helloText.pack();
        shell.pack();
        shell.open();
        
        //判断是否关闭窗口
        while (!shell.isDisposed())
        {
            if (!display.readAndDispatch())
                display.sleep();
            display.dispose();
        }
    }
}
--------------------编程问答-------------------- 你引入DLL文件了吗
补充:Java ,  Eclipse
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,