Full screen Window won't get keyboard input using KeyListener or KeyBoardFocusManager

前端 未结 2 1300
我寻月下人不归
我寻月下人不归 2021-01-18 04:34

I\'m having problems with getting my KeyBoardFocusManger to work with my full screen Window. No matter what, it just wont get keyboard input. I use

2条回答
  •  無奈伤痛
    2021-01-18 05:02

    As shown in this related FullScreenTest, you can use the same Action instance for the button and the key binding.

    Addendum: @nIcE cOw asks, Can we add more than one key on the same JComponent by using InputMap and ActionMap, and use the same AbstractAction class?

    Yes, multiple key bindings are possible; I sometimes invoke doClick() to get the audio-visual feedback, as shown here.

提交回复
热议问题