Put all available controls in a combobox

I intended to do this by myself… but I can't quite get it… I am making a dynamic setter of controls for my game… and I'd like to enumerate in a JComboBox all the keys on the keyboard with their corresponding JME keycode…



here's my code:



String[] items;

public void defKeys(){
      boolean mhelz = true;
      items = new String[250];
      int cnt=1;
      String[] EMPTY_STRING_ARRAY = new String[0];
      while(mhelz){
         try{
            items[cnt] = KeyInput.get().getKeyName(cnt) + " : "+ cnt;
            cnt++;
         }catch(Exception e){
            mhelz=false;
         }
         
      }
      
      List<String> tempList = new ArrayList<String>(Arrays.asList(items));
      tempList.removeAll(Arrays.asList(new Object[]{null}));
      String[] tempArray = tempList.toArray(EMPTY_STRING_ARRAY);
      String[] tempArray2 = new String[tempArray.length];
      
      cnt = 0;
      for(int i=0; i < tempArray.length; i++){
         tempArray2[cnt] = tempArray[i];
         try{
         if(!tempArray2.equals(null))
         if(!tempArray2[cnt].substring(0, 7).equals("Unknown")){
            cnt++;
         }
         }catch(Exception e){}
      }
      
      List<String> list = new ArrayList<String>(Arrays.asList(tempArray2));
      list.removeAll(Arrays.asList(new Object[]{null}));
      list.remove("Unknown keyCode: 0x100f9 (code: 249)");
      items = null;
      items = list.toArray(EMPTY_STRING_ARRAY);
   }



how do I enumerate all the keys in a jcombobox produced by JME's KeyInput.java