Hi i have an alert screen that contains a guage that acts has a loading screen. i have this alert screen on a seperate thread class. The main canvas class creates a new object of that alert screen and does some process that while the main class does a process, the gauge gets updated by setting the values of the gauge.

The problem is that when i start the alert Thread, the screen doesnt display while i debug it and only displays it at the end of the main canva's process.

below is the code for the alert screen thread.

Code:
public class load implements Runnable
{
    
    /** Creates a new instance of load */
    
      //possible states
    public static final int STATE_RUNNING = 0;
    public static final int STATE_STOP = 1;
    public int state;
    Thread t;
    public VideoPoker root;
    public Alert alert = new Alert ("Loading");
    private int MAX = 10;
    private int INIT = 0;
    private Gauge load;
    public int VALUE = 0;
    public boolean begin = true;
    
//VideoPoker is the root Midlet class
    public load(VideoPoker midlet) 
    {
        this.root = midlet;
        load = new Gauge(null, false, MAX, INIT);
        
        alert.setIndicator(load);
        alert.setTimeout(alert.FOREVER);
        
        
        
    }
    
    public void start()
    {
        t = new Thread();
        t.start();
    }
    public void stop()
    {
        t = null;
    }
    
    public void run()
    {
        while(state != STATE_STOP)
        {
            try
            {
              
               
                
                load.setValue(VALUE);
                Display.getDisplay(root).setCurrent(alert);
                 Thread.sleep(500);
                
                if(VALUE == MAX)
                {
                    alert.setTimeout(2000);
                    
                }
                
            }
            catch(Exception e)
            {
                
            }
        }
    }
    
    
}

And here is the main class that calls it and does a login process.

Code:
 
//if user clicked on a command button called login do this....
if(c == Login)
       {
           //create a load screen object
           load load_screen = new load(root);
           
                    
            //start Thread
            load_screen.state = load.STATE_RUNNING;
            new Thread(load_screen).start();
           //store username and password
            load_screen.begin = false;
            p = log.passw();
         
            //increment the gauge value by 2
            load_screen.VALUE = load_screen.VALUE + 2;
            u = log.user();
            
          
            
     
            
            
            boolean finish;
            
            
            load_screen.VALUE = load_screen.VALUE + 2;
           
           
           
            if((p.length() == 0) || (u.length() == 0) || p.trim().length()==0 || u.trim().length() == 0 )
            {
                    //gets the values from a textfile and checks if none of the values are  blank
               
                //display error message
                Alert error = new Alert ("Error");
                error.setString("Error, Please make sure both fields are not blank ");
                error.setTimeout (3000);
                Display.getDisplay(root).setCurrent(error);
                
                //sets the gauge to be completed
                load_screen.VALUE = 10;
                
            }
            else
            {
                //run garbage collector
               System.gc();

               //increment the gauge value by 2
               load_screen.VALUE = load_screen.VALUE + 2;
                line = root.login(u,p);
                load_screen.VALUE = load_screen.VALUE + 2;
               
                    String bad = "BADLOGIN";
                    
               
                   if(line.equals(bad))
                   {
                        //sets the gauge to be completed
                        load_screen.VALUE = 10;
                        Alert in = new Alert ("Error");
                        in.setString("Username or password is invalid");
                        in.setTimeout (3000);
                        Display.getDisplay(root).setCurrent(in, this);
                        

                        line = "";
                        line1 = "";
                        line2 = "";
                        load_screen.state = load.STATE_STOP;
                   }
                   else
                   {
                        
                       //display error message
                        //increment the gauge value by 2
                        load_screen.VALUE = load_screen.VALUE + 2;
                        Alert in = new Alert ("Logged In");
                        in.setString("You have succesfuly logged into the system");
                        in.setTimeout (3000);
                        Display.getDisplay(root).setCurrent(in, this);
                        


                        loggedIn = true;
                        logged = "Log out";

                        //line = "";
                        line1 = "";
                        line2 = "";
                        
                        //stop the load screen.
                        load_screen.state = load.STATE_STOP;
                        

                   }
                    
                    
                    
                   
                }
Thanks for your help