import javax.microedition.lcdui.*; import javax.microedition.midlet.*; public class Draw extends Canvas implements Runnable{ int position = 10; int end = getWidth(); public Draw() { super();} public void start() { Thread t = new Thread(this); t.start(); } public void run() { while(true) { if(position > end) position = 0; position++; }repaint(); try{ Thread.sleep(20);} catch(java.lang.InterruptedException zxz){}; } public void paint(Graphics g) { int x = g.getClipWidth(); int y = g.getClipHeight(); g.setColor(0xffffff); g.fillRect(0,0,x,y); g.setColor(0,0,200); g.fillRect(position,40,20,20); } }