How can I convert a key code into a char or string?

后端 未结 6 1448
无人共我
无人共我 2020-12-11 14:46

How to convert the keycode into char or string??

Here is the example code:

public boolean onK         


        
6条回答
  •  执笔经年
    2020-12-11 15:41

    If you don't have a KeyEvent object you can use this on the keycode :

    public void onKey(int primaryCode, int[] keyCodes) {
         char c = Character.toChars(primaryCode)[0];
    }
    

提交回复
热议问题