RFR: 8150564: Migrate useful ExtendedRobot methods into awt.Robot [v4]
Chen Liang
liach at openjdk.org
Thu Sep 4 00:15:49 UTC 2025
On Fri, 29 Aug 2025 00:24:01 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:
>> Some useful methods (click, glide, waitForIdle, type) in ExtendedRobot should be migrated into Robot itself so that ExtendedRobot can be removed in the future. The tests using these ExtendedRobot methods will be handled separately.
>
> Damon Nguyen has updated the pull request incrementally with one additional commit since the last revision:
>
> Add finally block
src/java.desktop/share/classes/java/awt/Robot.java line 792:
> 790: /**
> 791: * A convenience method that simulates clicking a mouse button by calling {@code mousePress}, {@code mouseRelease},
> 792: * and {@code waitForIdle}. Invokes {@code waitForIdle} with a default delay of 20 milliseconds after
Suggestion:
* and {@code waitForIdle}. Invokes {@code waitForIdle} with a default delay of {@value #DEFAULT_STEP_DELAY} milliseconds after
This renders `20` as a link that links to the constant that users can use.
src/java.desktop/share/classes/java/awt/Robot.java line 855:
> 853: *
> 854: * @implSpec Invokes {@link #mouseMove(int, int) mouseMove} with a default
> 855: * {@link #DEFAULT_STEP_LENGTH step-length} and {@link #DEFAULT_STEP_DELAY step-delay}.
You can use:
* @implSpec Invokes {@link #mouseMove(int, int) mouseMove} with a step-length
* of {@value #DEFAULT_STEP_LENGTH} and a step-delay of {@value #DEFAULT_STEP_DELAY}.
Renders like:
> Invokes [`mouseMove`]() with a step-length of [`2`]() and a a step-delay of [`20`]().
Same for other sites.
src/java.desktop/share/classes/java/awt/Robot.java line 977:
> 975: public synchronized void type(int keycode) {
> 976: keyPress(keycode);
> 977: waitForIdle(20);
Should this use `DEFAULT_STEP_DELAY` too?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26969#discussion_r2320487184
PR Review Comment: https://git.openjdk.org/jdk/pull/26969#discussion_r2320510533
PR Review Comment: https://git.openjdk.org/jdk/pull/26969#discussion_r2320511282
More information about the client-libs-dev
mailing list