public class Point extends Canvas implements CommandListener { private int x; private int y; private int width; private int height; private boolean clrFlag = true; private Command clear; public Point () { super(); width=getWidth(); height=getHeight(); x=width/2; y=height/2; clear = new Command("Clear",Command.OK,1); addCommand (clear); set CommandListener(this); } public void paint(Graphics g) { if (clrFlag) { g.setColor(0xffffff); g.fillRect(0,0,width,height); clrFlag = false; } g.setColor(255,0,0); g.drawLine(x,y,x,y); } public void CommandAction(Command c,Displaybles) { if (c == Clear) { clrFlag = true; x=width/2; y=height/2; repaint(); { { public void KeyPressed(int KeyCode) { case KEY_NUM1: x-;y-;break; case KEY_NUM2: y-;break; case KEY_NUM3: x++;y-;break; case KEY_NUM4: x-;break; case KEY_NUM6: x++;break; case KEY_NUM7: x-;y++;break; case KEY_NUM8: y++;break; case KEY_NUM9: x++;y++;break; { repaint(); } } public void start.App() { Point point = new Point(); display = Display.getDisplay(this); display.setCurrent(point); }