www.pudn.com > phonebk.rar > AccoutRead.java


/* 
 * AccoutRead.java 
 * 
 * Created on 2006年3月22日, 下午12:17 
 *线程,用于读取accout中的数据,并进行判断如何执行。 
 * To change this template, choose Tools | Options and locate the template under 
 * the Source Creation and Management node. Right-click the template and choose 
 * Open. You can then make changes to the template in the Source Editor. 
 */ 
 
package com.j2medev.sample.phonebook; 
 
/** 
 * 
 * @author Admin 
 */ 
public class AccoutRead extends Thread{ 
    private boolean done = false; 
    private PhoneBookMidlet midlet; 
     
    /** Creates a new instance of AccoutRead */ 
    public AccoutRead(PhoneBookMidlet midlet) { 
        this.midlet = midlet; 
    } 
   public void run(){ 
       if(!done){ 
           boolean infor = midlet.getinfor(); //从accout中得到用户信息,用于进行判断下一步如何执行 
           synchronized(midlet){ 
               try{ 
               midlet.wait(); 
               }catch(InterruptedException e){ 
                   e.printStackTrace(); 
               } 
               midlet.setCurrent(infor);  //根据得到的信息,进行下一步的执行。 
           } 
       } 
   }  
}