import javax.microedition.lcdui.*; public class MyCanvas extends Canvas implements Runnable { int x, y , l = 10, count; int[] trajectoryX = new int[]{0, 100}; int[] trajectoryY = new int[]{0, 0}; public MyCanvas() { super(); } public void start() { Thread thread = new Thread(this); thread.start(); } public void run() { for(count=0;count<=trajectoryX.length;count++) { repaint(); x=trajectoryX[count]; y=trajectoryY[count]; try{ Thread.sleep(250); } catch(java.lang.InterruptedException zxz){ } } } public void paint(Graphics g) { g.setColor(255,255,255); g.fillRect(0,0,getWidth(),getHeight()); g.setColor(0,0,0); g.fillRect(x,y,l,l); } }