My J2ME Programming Contact (3)--gauge

Source: Internet
Author: User
Tags exit
Programming
* * * Gaugelet.java * * Created on April 15, 2005, 5:19

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

/** * * @author   administrator * @version  */public class Gaugelet extends MIDlet implements commandlistener{        Private gauge agauge;    private Form aform;     Private Command exitcommand;    private command okcommand;    Private Display adisplay;    Private Alert analert;        public Gaugelet () {                aform=new Form (" Gaugetest ");        exitcommand=new Command (" EXIT ", command.exit,1);         okcommand=new Command ("OK", command.ok,1);         agauge=new Gauge ("Gaugedisplay", true,100,50);        anAlert=new Alert ("Value", Null,null,alerttype.info);                Aform.addcommand (Exitcommand);        AForm.addCommand ( Okcommand);        aform.append (agauge);         Aform.setcommandlistener (this);           }     public void startApp () {                 Adisplay=display.getdisplay (This);        adisplay.setcurrent (aForm);    }        public void Pauseapp () {   }         public void Destroyapp (Boolean unconditional) {   }         public void Commandaction (Command c,displayable D) {                 String s= "The Value is";       &nBsp int i;                if (c==exitcommand) {                          Destroyapp (False);            Notifydestroyed ();       }                 else{                        I=agauge.getvalue ();             s+=integer.tostring (i);             analert.setstring (s);             Adisplay.setcurrent (Analert,aform);                               }    }}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.