Class KeyboardEvent

  • All Implemented Interfaces:
    java.lang.Runnable

    public class KeyboardEvent
    extends java.lang.Object
    implements java.lang.Runnable
    • Constructor Summary

      Constructors 
      Constructor Description
      KeyboardEvent​(java.lang.String message, boolean enter)  
      KeyboardEvent​(java.lang.String message, boolean enter, boolean mistakes)  
    • Constructor Detail

      • KeyboardEvent

        public KeyboardEvent​(java.lang.String message,
                             boolean enter)
      • KeyboardEvent

        public KeyboardEvent​(java.lang.String message,
                             boolean enter,
                             boolean mistakes)
    • Method Detail

      • generateEvent

        public void generateEvent()
      • pressEnter

        public void pressEnter()
      • pressBackspace

        public void pressBackspace()
      • pressSpecialKey

        public void pressSpecialKey​(int key)
      • shift

        public void shift​(int eventType)
        Pushes shift and then sleeps for the calculated sleep time afterwards
        Parameters:
        eventType - KEY_PRESSED or KEY_RELEASED
      • shift

        public void shift​(int eventType,
                          boolean sleep)
        Pushes shift with given event type and then sleeps for a calculated sleep time after pushing if the sleep arg is true. If it's false it does not sleep after the event.
        Parameters:
        eventType - KEY_PRESSED or KEY_RELEASED
        sleep - true if you want it to sleep after sending the event, else false
      • dispatchPressed

        public void dispatchPressed​(char character)
      • dispatchTyped

        public void dispatchTyped​(char character)
      • dispatchReleased

        public void dispatchReleased​(char character)
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • getMistake

        public java.lang.String getMistake​(char c)
      • getRandomCharInString

        public java.lang.String getRandomCharInString​(java.lang.String s)