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

📄 locationairportsearch.java

📁 这是一个手机上的J2ME程序
💻 JAVA
字号:
// J2ME Compass
// Copyright (C) 2007 Dana Peters
// http://www.qcontinuum.org/compass

package org.qcontinuum.compass;

import javax.microedition.lcdui.*;
import org.qcontinuum.astro.*;

public class LocationAirportSearch extends Progress {
    
    private Displayable mParent;
    private Location mLocation;
    private String mAirportCode;

    public LocationAirportSearch(Displayable parent, Location location, String airportCode) {
        super("Airport Search", parent);
        mParent = parent;
        mLocation = location;
        mAirportCode = airportCode;
        start();
    }

    public void run() {
        Object findResult = AirportCode.find(this, mAirportCode);
        if (!isShown())
            return;
        if (findResult == null) {
            Alert alert = new Alert("Airport not found");
            alert.setTimeout(Alert.FOREVER);
            alert.setType(AlertType.ERROR);
            alert.setString(
                    (mAirportCode.length() > 0 ? "The airport code \"" + mAirportCode + "\" was not found. " : "")
                    + "Please enter the 3 or 4 letter code for the nearest airport. "
                    + "For example, enter LHR for London Heathrow. "
                    + "This code normally appears on luggage tags.");
            Compass.display(alert, mParent);
        } else {
            if (findResult instanceof EarthPosition) {
                EarthPosition earthPosition = (EarthPosition)findResult;
                mLocation.Name = "";
                mLocation.AirportCode = mAirportCode;
                mLocation.LatMinutes = (short)earthPosition.latTotalMinutes();
                mLocation.LongMinutes = (short)earthPosition.longTotalMinutes();
                Compass.display(mParent);
            } else if (findResult instanceof String[]) {
                String[] airports = (String[])findResult;
                Alert alert = new Alert("Multiple Airports");
                alert.setTimeout(Alert.FOREVER);
                alert.setType(AlertType.ERROR);
                alert.setString(
                    "Multiple airports use the 3-letter code \"" + mAirportCode + "\". "
                    + "Please select the 4-letter code that uniquely identifies the correct airport.");
                Compass.display(alert,
                    new LocationAirportChoose(mParent, mLocation, airports));
            }
        }
    }

}

⌨️ 快捷键说明

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