ho provato come hai detto tu ma addirittura non mi carica neanche l'applet..ho usato il tuo codice oppurtunamente modificato in questa maniera:
codice:
private class MyKeyListener extends KeyAdapter {
public void keyPressed(KeyEvent ke){
switch (ke.getKeyCode()){
case KeyEvent.VK_LEFT:sxtrue();break;
case KeyEvent.VK_RIGHT:dxtrue();break;
}
repaint();
}
public void keyReleased(KeyEvent ke){
switch (ke.getKeyCode()){
case KeyEvent.VK_LEFT:sxfalse();break;
case KeyEvent.VK_RIGHT:dxfalse();break;
}
repaint();
}
public void keyTyped(KeyEvent ke){
switch (ke.getKeyCode()){
case KeyEvent.VK_LEFT:sxtrue();break;
case KeyEvent.VK_RIGHT:dxtrue();break;
}
repaint();
}
}
public void init(){
this.addKeyListener(new MyKeyListener());
this.setFocusable(true);
}