I managed to figure it out:
// Snipped from my Keyboard class (which implements KeyListener)
private boolean keySwitch = false;
public void keyPressed(KeyEvent e)
{
keys[e.getKeyCode()] = true;
keys2[e.getKeyCode()] = true;
}
public void keyReleased(KeyEvent e)
{
keys[e.getKeyCode()] = false;
if (!keySwitch)
{
keys2[e.getKeyCode()] = true;
keySwitch = true;
}
else
{
keys2[e.getKeyCode()] = false;
keySwitch = false;
}
}
My mistake was that I was messing about in keyPressed(), when I needed to control keyReleased().
keys[] are keys that turn off when key is
released.
keys2[] are keys that turn off when key is
pressed a second time.
Thanks anyways, though.