⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startprogress.java

📁 GPS Track connects to a GPS and records the path that you travel. Tracks can be uploaded to a web s
💻 JAVA
字号:
// J2ME GPS Track
// Copyright (C) 2006 Dana Peters
// http://www.qcontinuum.org/gpstrack

package org.qcontinuum.gpstrack;

import javax.microedition.lcdui.*;
import java.util.*;

public class StartProgress extends Form implements CommandListener {

    private Displayable mParent;
    private Command mCancelCommand;
    private Gps mGps;
    private Timer mTimer;

    public StartProgress(Displayable parent) {
        super("Start");
        mParent = parent;
        Preferences preferences = GpsTrack.getPreferences();
        mGps = GpsTrack.getGps();
        append(new StringItem(null, "Connecting to GPS...\n"));
        if (GpsTrack.midp2Capable())
            append(new Gauge(null, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING));
        mGps.open();
        addCommand(mCancelCommand = new Command("Cancel", Command.CANCEL, 0));
        setCommandListener(this);
        mTimer = new Timer();
        mTimer.schedule(new StartProgressTimerTask(), 1, 1000);
    }

    public class StartProgressTimerTask extends TimerTask {
        public void run() {
            if (mGps.getNmeaCount() > 0) {
                mTimer.cancel();
                try {
                    GpsTrack.getTrack().open();
                } catch (Exception ex) {
                    GpsTrack.display(ex, GpsTrack.getTrackStatus());
                }
                GpsTrack.display(GpsTrack.getTrackStatus());
            }
        }
    }

    public void commandAction(Command c, Displayable d)  {
        if (c == mCancelCommand) {
            mTimer.cancel();
            mGps.close();
            GpsTrack.display(mParent);
        }
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -