I’m trying to make my input class and i’ve got the following methods for the keyListener
public void keyPressed(KeyEvent arg0) {
if(!typeMode)
keys[arg0.getKeyCode()] = true;
if(debug)
System.out.println("key pressed:"+ arg0.getKeyCode() +":"+getKeyText(arg0.getKeyCode()));
}
public void keyReleased(KeyEvent arg0) {
if(!typeMode)
keys[arg0.getKeyCode()] = false;
if(debug)
System.out.println("key released:" + arg0.getKeyCode() + ":" + getKeyText(arg0.getKeyCode()));
}
However, when i press the key and release it, it triggers keyRelease, but doesn’t change the state of the key. In other words, after i let go of the key, it’s still saying that the key is pressed. I’m not quite sure why it is doing this. Any help is appreciated.