Java applet need help please look!

I am currently tying to make a java game in a applet but my keyboard function wont work do you have any idea? this is my function:

public boolean KeyDown(Event evt, int Key){
if(Key == Event.RIGHT){
x_pos += rspeed;
}else if(Key == Event.LEFT){
x_pos -= lspeed;
}