help me plis..
i got some error: this application does not use the screen and runs in the backgroud.
.but i don't know what's the problem causing that..
anybody know how to fix it?? i just want to see the gauge bar progressing in MIDLET..

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;


public class gaugeDemo extends MIDlet {
    private Display d;
    private Form f;
    private Gauge g;
    public gaugeDemo(){
        long a = 0;
        f = new Form("Tentang Gauge");
        g = new Gauge("Ini Gauge", false,100,0);
        for (int i=0; i<100;i++){
            g.setValue(i);
            a= System.currentTimeMillis();
            while (System.currentTimeMillis()-a<1000);
        }
       
        
        f.append(g);
    }
    public void startApp() {
        d = Display.getDisplay(this);
        d.setCurrent(f);
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }
}

f.show() for if you want to see the form

after i type that, i find that
there is no method named by show()
so what must i do??

@efxee no such thing as javax.microedition.lcdui.Form.show(), you better check Java Microedition API

@hendrik92 I think the problem goes down to your for loop with that out of place while statement. Nice simple example of multiple gauges can be found in book Beginning J2ME: From Novice to Professional, chapter 6

yes it is lwuit library Form class..
http://lwuit.java.net/javadocs/com/sun/lwuit/Form.html

i forgot to see the imports of hendrik92 (line 1,2)

i got the error and corrected it

put your for loop line 13 to 17 in another method and than call that method in the last of startApp

public void startApp() {
        d = Display.getDisplay(this);
        d.setCurrent(f);
        start();

    }


public void start()
{

 for (int i=0; i<100;i++){
            g.setValue(i);
            a= System.currentTimeMillis();
            while (System.currentTimeMillis()-a<1000);
        }
       
}

don't forget to globalize long a

Off topic rant: LWUIT, I did not bought their idea 3 years ago, an library that has to be packaged on an application as nobody was supporting it and even now it has very little support, and I will not do buy it now. From what I can see on market people with BlackBerry specific knowledge are still welcome, but market is generally looking for Android and iPhone developers, Java Microedition remains only south America and Asia (mainly India, Pakistan, Bangladesh and Philippines) due to economical/financial reasons

peter:haven't understand at all.. but thanks for your link..
efxee: thanx for your reply.. but i just got a word from my lecturer that class System is just in J2SE.. XD

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.