No Compiling Error but doesn't work

import java.awt.*;

import java.awt.geom.*;

import java.awt.event.*;

import java.applet.*;

public class javacw extends Applet implements KeyListener, Runnable

{

Area pandaArea;

Graphics2D g2d;

// Providing coordinate control for the Panda

int pandax=20, panday=50;

// Animation condition. True = animate, False = static.

boolean pandabool=false, laidOut=false;

boolean left;

boolean right;

boolean up;

boolean down;

Thread animThread;

Dimension offDimension;// Defines an offscreen Dimension

Image offImage;// Defines an offscreen Image

Graphics offGraphics;// Defines an offscreen Graphics

Image panda;// Defines an Image object for panda

public void init() {

// Set the layout of the applet to null

setLayout(null);

panda = getImage(getCodeBase(), "panda.gif");

}

public void keyTyped(KeyEvent event){}

public void keyPressed(KeyEvent event)

{

if (event.getKeyCode() == KeyEvent.VK_LEFT) left = true;

if (event.getKeyCode() == KeyEvent.VK_RIGHT) right = true;

if (event.getKeyCode() == KeyEvent.VK_DOWN) down = true;

if (event.getKeyCode() == KeyEvent.VK_UP) up = true;

repaint();

}

public void keyReleased(KeyEvent e)

{

if (e.getKeyCode() == KeyEvent.VK_LEFT) left = false;

if (e.getKeyCode() == KeyEvent.VK_RIGHT) right = false;

if (e.getKeyCode() == KeyEvent.VK_UP) up = false;

if (e.getKeyCode() == KeyEvent.VK_DOWN) down = false;

repaint();

}

public void start()

{

// Make sure the thread hasn already been created

if (animThread == null) {

animThread = new Thread(this, "anim");

animThread.start();

}

}

public void run() {

// Create a current thread.

Thread myThread = Thread.currentThread();

// As long as the thread is created, keep redrawing the

// canvas and then pausing for 10 miliseconds.

while (animThread == myThread) {

repaint();

try {

Thread.sleep(10);

} catch (InterruptedException e){}

}

}

public void paint(Graphics g) {

if (offImage != null) {

g.drawImage(offImage, 0, 0, null);

}

}

// Overide the update() method

public void update(Graphics g) {

Dimension d = getSize();

// Create the offscreen graphics context

if ((offGraphics == null)

|| (d.width != offDimension.width)

|| (d.height != offDimension.height)) {

offDimension = d;

offImage = createImage(d.width, d.height);

offGraphics = offImage.getGraphics();

}

// Erase the previous image

offGraphics.setColor(getBackground());

offGraphics.fillRect(0, 0, d.width, d.height);

offGraphics.setColor(Color.black);

paintFrame(offGraphics);// Paint the frame into the image

g.drawImage(offImage, 0, 0, null);// Paint the image onto the screen

}

public void paintFrame(Graphics g) {

Graphics2D g2d = (Graphics2D)g;

g2d.drawImage(panda, pandax, panday, this);

if (pandabool) {// If pandabool==true, animate the panda =)

if (pandax>400) pandax=0;

if(pandax<0)pandax=400;

}

}

public void stop()

{

animThread = null;

offImage = null;

offGraphics = null;

}

public void destroy(){}

public void Move ()

{

if (left) {

pandax-=10;

}

if (right) {

pandax+=10;

}

if (up){

panday-=10;

}

if (down){

panday+=10;

}

}

}

i was trying to add the keylistener to makes my pic move and there are no compiling problem but it doesn't work when i press the key

thx for everyone

[3846 byte] By [Geoffreya] at [2007-10-2 7:03:36]
# 1
Duplicate of this post http://forum.java.sun.com/thread.jspa?threadID=689418&messageID=4009983#4009983
ChuckBinga at 2007-7-16 20:34:12 > top of Java-index,Developer Tools,Java Compiler...
# 2
One problem might be your lack of a setVisible( true ). It would be easier to read if you put code tags around your code.
ThomasOwensa at 2007-7-16 20:34:12 > top of Java-index,Developer Tools,Java Compiler...