📄 pointform.java
字号:
import javax.microedition.lcdui.*;
public class PointForm extends Form implements CommandListener
{
TripMate main;
Trip trip;
int pointIndex;
PointList list;
Point point;
TextField description;
ChoiceGroup direction;
PointForm(Trip trip, int pointIndex, TripMate main, PointList list)
{
super("Trip point");
this.main = main;
this.trip = trip;
this.pointIndex = pointIndex;
this.list = list;
point = trip.points[pointIndex];
int prevTime = (pointIndex == 0) ? trip.time : trip.points[pointIndex-1].time;
direction = new ChoiceGroup("Direction", Choice.EXCLUSIVE, TripMate.directions, TripMate.arrows);
direction.setSelectedIndex(point.direction, true);
description = new TextField("Description", point.description, 256, TextField.ANY);
append(direction);
append(description);
append(new StringItem("Time", Converter.timeToString(point.time - prevTime)));
setCommandListener(this);
addCommand(TripMate.UPDATE_CMD);
addCommand(TripMate.BACK_CMD);
Display.getDisplay(main).setCurrent(this);
}
public void commandAction(Command c, Displayable d)
{
if (c == TripMate.UPDATE_CMD) {
int i = direction.getSelectedIndex();
if (i >= 0) {
point.direction = i;
}
point.description = description.getString();
main.updatePoint(point);
list.set(pointIndex, point.description, main.arrows[point.direction]);
}
Display.getDisplay(main).setCurrent(list);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -