Keys still being marked as pressed?

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.

The only way that can be possible is if typeMode is true when the key is being released. Add an extra debug message saying if typeMode is true or false.

Ok, i’ve solved the problem. The issue that i was having was that i was using that key as a command to take the window out of fullscreen mode, however, when it did so, it removed the keyListeners. I solved the problem by adding a statement to add the keyListener again after the normal window has been created.