javakeyboardkeykeyeventpressed

Java get Maximum KeyID from KeyEvent


Hello I am trying to make an array list of pressed/released keys on keyboard in my application, but for that I would need to define max size of my array. I am unable to find how to detect MAX_VK pressed Key that returns me maximum KEY_ID that can be pressed.

Something similar to ALLEGRO_KEY_MAX from: https://www.allegro.cc/manual/5/keyboard.html

I would be really grateful if someone could help me <3.


Solution

  • A Set or Map can be more useful than a array for your use, but attending your question:

    CHAR_UNDEFINED -> 65535
    

    http://docs.oracle.com/javase/7/docs/api/constant-values.html#java.awt.event.KeyEvent.VK_Z