📄 locationairportcode.java
字号:
// J2ME Compass
// Copyright (C) 2007 Dana Peters
// http://www.qcontinuum.org/compass
package org.qcontinuum.compass;
import javax.microedition.lcdui.*;
public class LocationAirportCode extends TextBox implements CommandListener {
private Location mLocation;
private Displayable mParent;
private Command mOkCommand, mCancelCommand;
public LocationAirportCode(Location location, Displayable parent) {
super("Search Airport", "", 4, TextField.ANY);
mLocation = location;
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) {
String airportCode = getString().toUpperCase();
if (airportCode.length() == 3 || airportCode.length() == 4) {
Compass.display(new LocationAirportSearch(mParent, mLocation, airportCode));
} else {
Alert alert = new Alert("Airport Code");
alert.setTimeout(Alert.FOREVER);
alert.setType(AlertType.ERROR);
alert.setString("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, this);
}
} else if (c == mCancelCommand) {
Compass.display(mParent);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -