I am aware that there is a bug, a 12 or 13 year old bug, that exists on Linux and probably other Unix based systems, that certain ways of detecting when a key is pressed or released do not function the way one would expect. I am also aware there are a few ways around this and I have gone so far to attempt to implement this solution that can be viewed here:
http://stackoverflow.../4679195/596359The problem is that this does not seem to fix anything. The first question someone will ask I believe I can anticipate. I placed this code in a ".java" file named "RepeatingKeyEventsFixer.java". This file is in "../src/com/example/". To use it in my code I have put the following lines at the beginning of my main() method:
[font=Consolas, Menlo, Monaco,]RepeatingKeyEventsFixer[/font][color=#000000][font=Consolas, Menlo, Monaco,] repeatingkeyeventsfixer [/font][/color][color=#000000][font=Consolas, Menlo, Monaco,]=[/font][/color][color=#000000][font=Consolas, Menlo, Monaco,] [/font][/color][font=Consolas, Menlo, Monaco,]new[/font][color=#000000][font=Consolas, Menlo, Monaco,] [/font][/color][font=Consolas, Menlo, Monaco,]RepeatingKeyEventsFixer[/font][color=#000000][font=Consolas, Menlo, Monaco,]();[/font][/color]
[color=#000000]repeatingkeyeventsfixer[/color][color=#000000].[/color][color=#000000]install[/color][color=#000000]();[/color]
[color=#000000]
[/color]
Still, when I press down a key, it tells me it's being pressed down and held, but it will also say it is being released with just about the same frequency. Does anyone have any idea what I may have done wrong? I have also posted this on StackExchange with poor results. I'll post the link here in case the way I phrased things there could help any more: http://stackoverflow.../8948238/596359The following code is the code I am using to test if a key has been released or not. I appreciate the time any takes to consider my question.[color=#000000][font=Consolas, Menlo, Monaco,]addKeyListener[/font][/color][color=#000000][font=Consolas, Menlo, Monaco,]([/font][/color][font=Consolas, Menlo, Monaco,]new[/font][color=#000000][font=Consolas, Menlo, Monaco,] [/font][/color][font=Consolas, Menlo, Monaco,]KeyAdapter[/font][color=#000000][font=Consolas, Menlo, Monaco,]()[/font][/color][color=#000000][font=Consolas, Menlo, Monaco,] [/font][/color][color=#000000][font=Consolas, Menlo, Monaco,]{[/font][/color]
[color=#00008B]public[/color] [color=#00008B]void[/color] keyPressed([color=#2B91AF]KeyEvent[/color] e){
processKey(e);
}
[color=#00008B]public[/color] [color=#00008B]void[/color] keyReleased([color=#2B91AF]KeyEvent[/color] g){
processKeyReleased(g);
}
}
...
[color=#00008B]private[/color] [color=#00008B]void[/color] processKeyReleased([color=#2B91AF]KeyEvent[/color] g){
[color=#00008B]int[/color] keyCode = g.getKeyCode();
[color=#00008B]if[/color](!isPaused && !gameOver){
[color=#00008B]if[/color](keyCode == [color=#2B91AF]KeyEvent[/color].VK_LEFT || keyCode == [color=#2B91AF]KeyEvent[/color].VK_RIGHT){
[color=#2B91AF]System[/color].out.println([color=#800000]"released"[/color]);
player.stopLooping();
}
}
}