1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

I am having trouble completing the following code in threads.

Discussion in 'Java' started by n.desai, Apr 1, 2008.

  1. n.desai

    n.desai New Member

    Joined:
    Apr 1, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.MIDlet;
    
    
    public class GaugeDemo extends MIDlet implements CommandListener {
        private static final Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
        private Display display;
        private NonInteractiveGaugeRunnable nonInteractive;
        private Form mainForm;
    
        public GaugeDemo() {
            display = Display.getDisplay(this);
            mainForm = new Form("Gauge Demo");
            nonInteractive = new NonInteractiveGaugeRunnable("Non Interactive", 10, 0);
            new Thread(nonInteractive).start();
            mainForm.append(nonInteractive);
            mainForm.addCommand(CMD_EXIT);
            mainForm.setCommandListener(this);
        }
    
    
        protected void startApp() {
            display.setCurrent(mainForm);
        }
    
        protected void destroyApp(boolean unconditional) {
            nonInteractive.setDone();
        }
    
        protected void pauseApp() {
        }
    
        public void commandAction(Command c, Displayable d) {
            destroyApp(false);
            notifyDestroyed();
        }
    } 
    
    and one more canvas class 
    
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.MIDlet;
    
    
    public class GaugeDemo extends MIDlet implements CommandListener {
        private static final Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
        private Display display;
        private NonInteractiveGaugeRunnable nonInteractive;
        private Form mainForm;
    
        public GaugeDemo() {
            display = Display.getDisplay(this);
            mainForm = new Form("Gauge Demo");
            nonInteractive = new NonInteractiveGaugeRunnable("Non Interactive", 10, 0);
            new Thread(nonInteractive).start();
            mainForm.append(nonInteractive);
            mainForm.addCommand(CMD_EXIT);
            mainForm.setCommandListener(this);
        }
    
    
        protected void startApp() {
            display.setCurrent(mainForm);
        }
    
        protected void destroyApp(boolean unconditional) {
            nonInteractive.setDone();
        }
    
        protected void pauseApp() {
        }
    
        public void commandAction(Command c, Displayable d) {
            destroyApp(false);
            notifyDestroyed();
        }
    }
    Could some one help me please.
     
    Last edited by a moderator: Apr 2, 2008

Share This Page