import java.awt.*; import java.awt.event.*; import java.applet.*; import java.util.*; import static java.lang.System.*; public class forum_practice extends Applet implements KeyListener,ActionListener{ Image dot; int x = 0; int y = 0; public void init() { dot = getImage(getCodeBase(), "black.gif"); x = 100; y = 100; } public void paint(Graphics g) { g.drawImage(dot, x, y, this); } public void move(Graphics g,int x,int y){ g.drawImage(dot,x,y,this); } public void actionPerformed(ActionEvent e) { } @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode()==37){ x-=10; move(x,y); } if(e.getKeyCode()==38){ y-=10; move(x,y); } if(e.getKeyCode()==39){ x+=10; move(x,y); } if(e.getKeyCode()==40){ y+=10; move(x,y); } } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } }