Keyboard methods

Discussion in 'Developer Support' started by Exile, Aug 11, 2014.

  1. Can anyone care to explain how you do the following actions to me? I never used this before..

    1) Press enter
    2) Why is not accessible?
  2. I'm pretty sure to press enter after a string oyu do Keyboard.type("abc", true);
    So if you did Keyboard.type("", true); it should just press enter.
    But Keyboard.pressKey(Key.KEY_ENTER); is the proper way.
    And you're right, the Key enum isn't accessible for some reason. @Cloud
  3. This seems like a bypass/hacky solution lol

    I tried using Keyboard.pressKey(35) as this is the keycode for Enter, but this gives "Unsupported keycode, contact administrator" or something like that.
  4. @Cloud while you're making the enum accessible could you also revise the error message to be better. For example, "Unsupported keycode. Please contact an administrator."
  5. The error message has proper grammar and is polite if you mean that, I wasn't copy-pasting it ;)
  6. Gotcha. Doesn't hurt to double check while he's there though. :p
  7. I'm not entirely sure if I want to make it accessible, it was meant to be for internal use only.
  8. Then how do we fix this issue in a non hacking way?
  9. You're using the API wrong and passing in the wrong values. First of all you should be using typeKey, press and release key are much lower level and using them incorrectly will give you shitty results. Secondly, the keycode for enter is not 35. It is in fact 10 which is reflected by the KeyEvent.VK_ENTER constant in the java API.
  10. Oh I see.. I just googled java keycodes :p

Share This Page