Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
KeyListenerがどのように機能するかは知っていますが、問題は、抽象メソッドKeyPressedが期待どおりに機能しないことです。キーを押すたびに関数を呼び出すのではなく、キーが押されている間は常に関数を呼び出します。キーを押したときではなく、キーを押したときだけ処理できますか?
KeyListenerを実装し、keyPressedをオーバーライドします。keyReleasedが呼び出されるまで保持される値を設定します。