for(int i=0;i<KeyID.LAST.getKeyIndex();i++) { keyMap[i] = numKeys; } for(int i=0;i<numKeys;i++) { int tempNativeID = supportedKeys[i]; Keyboard.KeyID tempKeyID = StandardKeyboard.KeyID.VOID; try { tempKeyID = (Keyboard.KeyID)LinuxNativeTypesMap.getButtonID(tempNativeID); } catch (ClassCastException e) { System.out.println("LinuxNativeTypesMap.getButtonID() returned " + LinuxNativeTypesMap.getButtonID(tempNativeID).getClass().toString()); } if(tempKeyID.getKeyIndex() < keyMap.length) { keyMap[tempKeyID.getKeyIndex()] = i;  } else {  } }
Axis[] allButtons = realController.getButtons(); for(int i=0;i<allButtons.length;i++) { Axis tempButton = allButtons[i]; keyMap.put(tempButton.getIdentifier(), tempButton); }
    private void setupKeyMap() {        for(int i=0;i<KeyID.LAST.getKeyIndex();i++) {            keyMap[i] = numKeys;        }        for(int i=0;i<numKeys;i++) {            int tempNativeID = supportedKeys[i];            Keyboard.KeyID tempKeyID = StandardKeyboard.KeyID.VOID;            try {                tempKeyID = (Keyboard.KeyID)LinuxNativeTypesMap.getButtonID(tempNativeID);                            } catch (ClassCastException e) {                System.out.println("LinuxNativeTypesMap.getButtonID() returned " + LinuxNativeTypesMap.getButtonID(tempNativeID).getClass().toString());            }                        if(tempKeyID.getKeyIndex() < keyMap.length) {                keyMap[tempKeyID.getKeyIndex()] = i;                //System.out.println("keyMap[" + (tempKeyID.getKeyIndex()) + "] (" + tempKeyID + ") set to index " + i + " (" + LinuxNativeTypesMap.getButtonName(supportedKeys[i]) + ")");            } else {                //System.out.println("Linux key " + LinuxNativeTypesMap.getButtonName(tempNativeID) + " isn't supported by jinput");            }        }    }