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

请教:连接远程服务器时,怎么显示另外一个等待Form

发布时间:2010-06-05 12:33:55 文章来源:www.iduyao.cn 采编人员:星星草
请教:连接远程服务器时,如何显示另外一个等待Form?
连接服务器线程类:
public   class   LoginThread   implements   Runnable{
  String   loginURL=   "http://localhost/.../... "
  String   username= " ";
  String   password= " ";
  public   SeClientLoginThread(String   username,String   password){
                this.username=username;
                this.password=password;
        }

  public   void   run(){
                DataInputStream   ds=null;
                HttpConnection   hc=null;
                DataOutputStream   dos=null;
                DataInputStream   dis=null;
                try{
     //我是在这再加一个等待Form的装载代码:
     //   ConnectServerMidlet   connect=new   ConnectServerMidlet();
                  //display.setCurrent(connect.get_form());//显示等待画面
                //这样添加后当用户点击LoginMidlet后出现等待画面后程序就死掉了
                    hc   =   (HttpConnection)Connector.open(loginURL);
                        //设置请求属性
                        hc.setRequestMethod(HttpConnection.POST);
                  //下面是一堆有关跟服务器取得连接后的验证信息等
                  //....

              }
                  catch   (IOException   ex)   {
                ex.printStackTrace();
                }
}

}

等待画面:

public   class   ConnectServerMidlet   {

        private   Image   image;

        private   Form   connect;

        private   ImageItem   imageItem;
        public   Image   get_image()   {
                if   (image==   null)   {
                        //   Insert   pre-init   code   here
                        try   {
                                image=Image.createImage( "/com/swc/se/SeClient/Logic/waitscreen.png ");
                        }   catch   (java.io.IOException   exception)   {
                                exception.printStackTrace();
                        }
                        //   Insert   post-init   code   here
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: