专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Eclipse

这边每次都是在messagedialog这里卡住了,求解

发布时间:2010-06-05 15:33:50 文章来源:www.iduyao.cn 采编人员:星星草
这里每次都是在messagedialog这里卡住了,求解
import java.security.MessageDigest;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;


import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message_1_0;

import sun.misc.resources.Messages;
import sun.misc.resources.Messages_zh_CN;

/**
 * 
 */

/**
 * @author joycexu
 * 
 */
public class helloworld {

/**
* @param args
*/
public static void main(String[] args) {
final Composite shell;
// TODO Auto-generated method stub
final Combo combo =new Combo(shell,SWT.READ_ONLY);
combo.setBounds(16, 11, 100, 25);
final Button button1=new Button(shell,SWT.NONE);
button1.setBounds(17, 65, 100, 25);
button1.setText("设值");
button1.addSelectionListener(new SelectionAdapter(){
public void widgetSelected (SelectionEvent e){
combo.removeAll();
for(int i=1;i<=10;i++)
combo.add("第"+i+"个字符串");
combo.select(0);
}


});
final Button button2=new Button(shell,SWT.NONE);
button2.setBounds(136, 66, 100, 25);
button2.setText("取值");
button2.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e){
MessageDialog.openInformation(shell,null,combo.getText());

}

});

});
}


------解决方案--------------------
首先在这里给楼主个简单的关于SWT开发的列子:
Java code
package test;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class August_20_HellWorld
{
  public static void main(String[] args)
  {
    // display负责管理实践循环和控制UI线程和其他线程之间的通信
    final Display display = Display.getDefault();
    final Shell shell = new Shell();// Shell是程序的主窗口
    shell.setSize(400, 400);// 设置主窗口的大小
    shell.setText("SWT Aplication");// 设置主窗口的标题
    shell.layout();// shell应用界面布置
    shell.open();// 打开Shell主窗口
    while (!shell.isDisposed())// 如果主窗口没有关闭,则一直循环
    {
      if (!display.readAndDispatch())// 如果display不忙
      {
        display.sleep();// display休眠
      }
    }
  }
}
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: