📄 trackmenu.java
字号:
// J2ME GPS Track
// Copyright (C) 2006 Dana Peters
// http://www.qcontinuum.org/gpstrack
package org.qcontinuum.gpstrack;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
public class TrackMenu extends List implements CommandListener {
private Displayable mParent;
private Command mDetailsCommand, mUploadCommand, mEmailCommand, mBluetoothCommand, mFileCommand, mDeleteCommand, mCancelCommand;
public TrackMenu(Displayable parent) {
super("Tracks", List.IMPLICIT);
mParent = parent;
String recordStores[] = RecordStore.listRecordStores();
for (int i = 0; i < recordStores.length; i++) {
if (recordStores[i].compareTo("preferences") != 0) {
int j;
for (j = 0; j < size(); j++)
if (recordStores[i].compareTo(getString(j)) < 0)
break;
insert(j, recordStores[i], null);
}
}
addCommand(mDetailsCommand = new Command("Details", Command.ITEM, 0));
addCommand(mUploadCommand = new Command("Upload to web site", Command.ITEM, 1));
addCommand(mEmailCommand = new Command("Send via email", Command.ITEM, 1));
addCommand(mBluetoothCommand = new Command("Transfer via Bluetooth", Command.ITEM, 1));
addCommand(mFileCommand = new Command("Write to local file", Command.ITEM, 1));
addCommand(mDeleteCommand = new Command("Delete", Command.ITEM, 1));
addCommand(mCancelCommand = new Command("Back", Command.BACK, 0));
setCommandListener(this);
}
public void commandAction(Command c, Displayable d) {
String trackName = getString(getSelectedIndex());
if (c == mDetailsCommand) {
GpsTrack.display(new TrackDetails(this, trackName));
} else if (c == mUploadCommand) {
GpsTrack.display(new ExportMapUsername(this, trackName));
} else if (c == mEmailCommand) {
GpsTrack.display(new ExportFormat(this, trackName, Track.DESTINATION_EMAIL));
} else if (c == mBluetoothCommand) {
GpsTrack.display(new ExportFormat(this, trackName, Track.DESTINATION_BLUETOOTH));
} else if (c == mFileCommand) {
GpsTrack.display(new ExportFormat(this, trackName, Track.DESTINATION_FILE));
} else if (c == mDeleteCommand) {
try {
RecordStore.deleteRecordStore(trackName);
GpsTrack.display("Deleted \"" + trackName + "\".", 3, mParent);
}
catch (Exception ex) {
GpsTrack.display(ex, mParent);
}
} else if (c == mCancelCommand) {
GpsTrack.display(mParent);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -