On Wed, 22 Jan 2025 19:57:04 GMT, Harshitha Onkar <hon...@openjdk.org> wrote:

>> We wait long enough, so if it throws the `IIlegalCompnentStateException` 
>> something is not right anyway.
>> 
>> But I updated it to `waitTillShown` + get location on EDT to save some test 
>> execution time where it is possible.
>
> Sounds good.

> We wait long enough, so if it throws the `IIlegalCompnentStateException` 
> something is not right anyway.

I liked this way better.

> But I updated it to `waitTillShown` + get location on EDT to save some test 
> execution time where it is possible.

For what it's worth, we have a utility method for this… Yet I couldn't quickly 
find it, I found quite a few tests which implement it themselves.

I'd prefer using *an event-based approach* rather than delaying in a loop: 
releasing a latch when the frame receives focus.

At the same time, [a recent 
discussion](https://github.com/openjdk/jdk/pull/21475#discussion_r1809317633) 
proved that `robot.waitForIdle()` is enough… especially if it's followed by a 
delay. (Hence, [I removed the focus 
latch](https://github.com/openjdk/jdk/pull/21475/commits/d16918a43d397fc889172265fe9b950301073401).)

One more reason why I like `waitForIdle` + `delay` better is that the code is 
shorter. And *you still need `robot.waitForIdle()` any way.*

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22729#discussion_r1929032424

Reply via email to