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

📄 addpointform.java

📁 Program helping you to remember the route. It cab be route from conference room to coffee-room, it
💻 JAVA
字号:
import javax.microedition.lcdui.*;

public class AddPointForm extends Form implements CommandListener
{ 
    TripMate    main;
    Trip        trip;
    TextField   description;
    ChoiceGroup direction;

    AddPointForm(Trip trip, TripMate main) 
    {
        super("Trip point " + (trip.points.length+1));
        this.main = main;
        this.trip = trip;
        direction = new ChoiceGroup("Direction", Choice.EXCLUSIVE, TripMate.directions, TripMate.arrows);
        description = new TextField("Description", "", 256, TextField.ANY);        
        append(direction);
        append(description);
        setCommandListener(this);
        addCommand(TripMate.ENTER_CMD);
        addCommand(TripMate.QUIT_CMD);
        if (trip.points.length != 0) { 
            addCommand(TripMate.FINISH_CMD);
        }
        Display.getDisplay(main).setCurrent(this);
    }
           
    public void commandAction(Command c, Displayable d) 
    {    
        if (c == TripMate.QUIT_CMD) {
            main.quit();
        } else if (c == TripMate.ENTER_CMD) {
            int i = direction.getSelectedIndex();
            if (i < 0) { 
                i = TripMate.FORWARD;
            }
            Point point = new Point(trip.id, i, description.getString(), (int)(System.currentTimeMillis()/1000));
            Point[] newPoints = new Point[trip.points.length+1];
            System.arraycopy(trip.points, 0, newPoints, 0, trip.points.length);
            newPoints[newPoints.length-1] = point;
            trip.points = newPoints;
            main.addPoint(point);
            new AddPointForm(trip, main);
        } else if (c == TripMate.FINISH_CMD) { 
            main.state.tripState = TripState.FINISHED;
            main.updateState();
            Display.getDisplay(main).setCurrent(main.mainMenu);
        }
    }
}

⌨️ 快捷键说明

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