当前位置: 代码迷 >> J2ME >> 求交互性Gauge例子程序,该如何处理
  详细解决方案

求交互性Gauge例子程序,该如何处理

热度:1033   发布时间:2016-04-17 22:17:05
求交互性Gauge例子程序
麻烦高手们贴点使用交互性Gauge例子程序的源码,我学习一下
或者提供《J2ME无线Java应用开发》的下载地址
谢谢了

------解决方案--------------------
前段时间研究UI时,网上找到的例子,正好发你
Java code
/* * GaugeTestMidlet.java * * Created on 2006年2月23日, 下午3:30 */import javax.microedition.midlet.*;import javax.microedition.lcdui.*;/** *  * @author Allan * @version */public class GaugeMidlet extends MIDlet implements CommandListener {    private Display display;    private Gauge g1;    private Command c1;    private Command c2;    private Command c3;    private Command c4;    public GaugeMidlet() {        display = Display.getDisplay(this);        c1 = new Command("CONTINUOUS_IDLE", Command.SCREEN, 1);        c2 = new Command("CONTINUOUS_RUNNING", Command.SCREEN, 1);        c3 = new Command("INCREMENTAL_IDLE", Command.SCREEN, 1);        c4 = new Command("INCREMENTAL_UPDATING", Command.SCREEN, 1);    }    public void startApp() {        Form f = new Form("Gauge test");        f.addCommand(c1);        f.addCommand(c2);        f.addCommand(c3);        f.addCommand(c4);        g1 = new Gauge("进度条一", false, Gauge.INDEFINITE, Gauge.CONTINUOUS_IDLE);        // g1 = new Gauge("进度条一", false, Gauge.INDEFINITE,        // Gauge.CONTINUOUS_RUNNING);        // g1 = new Gauge("进度条一", false, Gauge.INDEFINITE,        // Gauge.INCREMENTAL_IDLE);        // g1 = new Gauge("进度条一", false, Gauge.INDEFINITE,        // Gauge.INCREMENTAL_UPDATING);        f.setCommandListener(this);        f.append(g1);        display.setCurrent(f);    }    public void pauseApp() {    }    public void destroyApp(boolean unconditional) {    }    public void commandAction(Command c, Displayable s) {        // g1.setMaxValue(2);                if (c == c1) {            g1.setValue(Gauge.CONTINUOUS_IDLE);        } else if (c == c2) {            g1.setValue(Gauge.CONTINUOUS_RUNNING);        } else if (c == c3) {            g1.setValue(Gauge.INCREMENTAL_IDLE);        } else if (c == c4) {            g1.setValue(Gauge.INCREMENTAL_UPDATING);        }        System.out.println(g1.getValue());        System.out.println(g1.getMaxValue());    }}
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!