RFR: JDK-8353755 : Add a helper method to Util - findComponent() [v6]
Alexey Ivanov
aivanov at openjdk.org
Wed Nov 5 21:47:03 UTC 2025
On Wed, 5 Nov 2025 19:03:23 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
>> `findComponent(final Container container, final Predicate<Component> predicate)` is a useful utility method and thus added to` javax/swing/regtesthelpers/Util.java` instead of having redundant code in tests. It can be used to find a component by label name.
>>
>> PS: Existing `Util.findSubComponent()` finds component by class name but `findComponent()` can be used to search for a particular component by label name/title when there are multiple subcomponents of same type by applying a predicate logic.
>
> Harshitha Onkar has updated the pull request incrementally with two additional commits since the last revision:
>
> - revert unchanged lines
> - review update
Looks good to me, except for minor formatting nit.
test/jdk/javax/swing/regtesthelpers/Util.java line 150:
> 148: c -> c.getClass()
> 149: .getName()
> 150: .contains(className));
Suggestion:
return findComponent((Container) parent,
c -> c.getClass()
.getName()
.contains(className));
Correct alignment.
-------------
Marked as reviewed by aivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/27944#pullrequestreview-3424579183
PR Review Comment: https://git.openjdk.org/jdk/pull/27944#discussion_r2496280401
More information about the client-libs-dev
mailing list