Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4966881

RFE: Need API to get mouse and keyboard's Desktop specific properties



    • Cause Known
    • generic
    • generic


      Right now automation in java using java.awt.Robot class have several
      constraints and users have to specify arbitary delays to overcome
      these problems and because of these delays testcases become less
      portable across different platforms.

      Following are the constrainsts which can I point out:
      1) If you want to click the mouse than there must be call to mousePress
        & mouseRelease api with some specific amount of delay in between,
        There should be some way to get the delay from some API instead of
        user putting some arbitary value. Maybe attribute can be added in
        Desktop Properties which can be accessed by Toolkit. for e.g
        Optionally a API mouseClick can be added in Robot class which wraps
        all these details from naive user.
        something like
        public void mouseClick(int buttons) {
          // Give here OS specific delay

      2) Above case applies for double click of mouse also.

      3) Similarly there should be some property/api to get following
         keyboard desktop property.
         - Keyboard repeat delay - If you keep the keyboard key pressed than this is
          the time after which it will repeat the keyPress event
         - Keyboard repeat rate - Rate at which character is repeated when key is
          holded for a while.
          Optionally a wrapper can be provided in Robot class which types the key
          i.e instead of user making call to keyPress and keyRelease, user just need
          to make one call.
          something like
          public void keyType(int keycode) {
              // Give here OS specific delay

      ###@###.### 2003-12-11


        Issue Links



              Unassigned Unassigned
              hsinghsunw Hemant Singh (Inactive)
              0 Vote for this issue
              0 Start watching this issue