This is a really weird issue, but I just have a simple keyListener added to a JPanel that prints on keyPressed and on keyReleased. Usually it works fine, but on certain keys
I ran into this issue recently, it is caused by the MacOS showing a context menu when you hold certain keys down (To allow you to chose alternative language characters) and the bug report page had a good solution that worked for me:
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8167263
To disabled the character accent menu and enable auto-repeat, type the following at the command prompt:
defaults write -g ApplePressAndHoldEnabled -bool false
This can be reversed with the following:
defaults write -g ApplePressAndHoldEnabled -bool true
I just tried this on the mac console and my java application no longer has the key problem.