RFR: JDK-8353755 : Add a helper method to Util - findComponent() [v2]
Alexey Ivanov
aivanov at openjdk.org
Fri Oct 24 16:05:07 UTC 2025
On Thu, 23 Oct 2025 21:02:07 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 one additional commit since the last revision:
>
> review update
Changes requested by aivanov (Reviewer).
test/jdk/javax/swing/JFileChooser/FileSizeCheck.java line 236:
> 234: && "Details".equals(button.getToolTipText()));
> 235: return (AbstractButton) result;
> 236: }
In this case, I would leave the wrapped predicate parameter as is; otherwise, the lines become too long. This is why I chose to use the 8-column indentation for the second parameter rather than aligning it with the opening parenthesis.
test/jdk/javax/swing/JFileChooser/bug4759934.java line 77:
> 75:
> 76: JButton cancel = Util.invokeOnEDT(() -> findCancelButton(jfc));
> 77: cancel.doClick();
`doClick` should also be called on EDT.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27944#pullrequestreview-3377615091
PR Review Comment: https://git.openjdk.org/jdk/pull/27944#discussion_r2461135990
PR Review Comment: https://git.openjdk.org/jdk/pull/27944#discussion_r2461105056
More information about the client-libs-dev
mailing list