📄 locationsavename.java
字号:
// J2ME Compass
// Copyright (C) 2007 Dana Peters
// http://www.qcontinuum.org/compass
package org.qcontinuum.compass;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
public class LocationSaveName extends TextBox implements CommandListener {
private Displayable mParent;
private Location mLocation;
private Command mOkCommand, mCancelCommand;
public LocationSaveName(Location location, Displayable parent) {
super("Location Name", "", 15, TextField.ANY);
mLocation = location;
mParent = parent;
if (mLocation.Name != null && mLocation.Name.length() > 0) {
setString(mLocation.Name);
}
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 == mCancelCommand) {
Compass.display(mParent);
} else if (c == mOkCommand) {
String locationName = getString().trim();
if (locationName.length() > 0) {
mLocation.Name = locationName;
mLocation.save();
Compass.display(mParent);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -