import javax.microedition.lcdui.*; import java.io.*; public class MyCanvas extends Canvas implements Runnable{ Thread thread; Image image; int x,y; int Jump = -5; int Jump1 = Jump; public MyCanvas(){ setFullScreenMode(true); try{ thread=new Thread(this); image=Image.createImage("/1.png"); x=getHeight()/2; thread.start(); }catch(Exception e){} }public void run(){ try{ while (true) {if (Jump1 == Jump){ } else{ Jump1 ++; if (Jump1 < 0){ a=(x- (2 << (-Jump1))); } else{ if (Jump1 != -Jump - 1){ a=(x+(2 << Jump1)); } else{ Jump1 = Jump; }} thread.sleep(100); } } }catch(Exception e){} } public void paint(Graphics g){ g.setColor(3,2,1); g.fillRect(0, 0,getWidth() ,getHeight() );g.drawImage(image,getWidth()/2,y,20);repaint(); } public void keyPressed(int keyCode) { switch (keyCode) { case 49 : Jump1 ++;break; } repaint(); }public void keyRepeated(int keyCode){ if (keyCode==KEY_NUM1) repaint(); }public void keyReleased(int keyCode){ if (keyCode==KEY_NUM1) repaint(); } }