import java.applet.Applet; import java.awt.event.*; import java.awt.*; public class pulk extends Applet implements KeyListener{ int x=150, y=150; public pulk(){ init(); } public void init(){ addKeyListener(this); } public void paint(Graphics g){ g.setColor(Color.red); g.fillOval(x, y, 10, 60); } public void keyPressed(KeyEvent e){ int kood=e.getKeyCode(); if(kood==KeyEvent.VK_LEFT)x--; if(kood==KeyEvent.VK_RIGHT)x++; if(kood==KeyEvent.VK_UP)y--; if(kood==KeyEvent.VK_DOWN)y++; repaint(); } public void keyReleased(KeyEvent e){} public void keyTyped(KeyEvent e){} }