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

📄 startmenu.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.*;

public class StartMenu extends List implements CommandListener {

    private Displayable mParent;
    private Command mOkCommand, mCancelCommand;

    private static final String mOptionStrings[] = {
        "Bluetooth",
        "Serial Port"
    };

    public StartMenu(Displayable parent) {
        super("GPS Connection", List.IMPLICIT, mOptionStrings, null);
        mParent = parent;
        addCommand(mOkCommand = new Command("OK", Command.OK, 0));
        addCommand(mCancelCommand = new Command("Cancel", Command.CANCEL, 0));
        setCommandListener(this);
    }

    public void commandAction(Command c, Displayable d)  {
        if (c == mOkCommand || c == SELECT_COMMAND) {
            switch (getSelectedIndex()) {
                case 0: // Bluetooth
                    if (GpsTrack.bluetoothCapable())
                        GpsTrack.display(new StartHost(mParent).getDisplay());
                    else
                        GpsTrack.display("This device does not have Bluetooth or does not allow access from Java.", mParent);
                    break;
                case 1: // Serial
                    if (GpsTrack.serialCapable())
                        if (GpsTrack.midp2Capable())
                            GpsTrack.display(new StartPort(mParent));
                        else
                            GpsTrack.display("Serial ports are only accessible on devices with MIDP 2.", mParent);
                    else
                        GpsTrack.display("This device does not have a serial port or does not allow access from Java.", mParent);
                    break;
            }
        } else if (c == mCancelCommand) {
            GpsTrack.display(mParent);
        }
    }
   
}

⌨️ 快捷键说明

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