posts - 5,  comments - 0,  trackbacks - 0
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;


public class ButtonTest {

    /**
     * Launch the application
     * @param args
     */
    public static void main(String[] args) {
        final Display display = Display.getDefault();
        final Shell shell = new Shell();
        shell.setSize(500, 375);
        shell.setText("SWT Application");
        //

        shell.open();

        final Button sButton = new Button(shell, SWT.NONE);
        sButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                System.exit(0);
            }
        });
        sButton.setText("exit");
        sButton.setBounds(128, 173, 85, 22);
        sButton.setToolTipText("点击退出");
        shell.layout();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
    }

}


posted on 2008-03-31 07:08 hakuci 阅读(271) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 
<2008年3月>
2425262728291
2345678
9101112131415
16171819202122
23242526272829
303112345

常用链接

留言簿(1)

随笔档案(5)

搜索

  •  

最新评论

阅读排行榜

评论排行榜