RFR: 8367348: Enhance PassFailJFrame to support links in HTML
Alexey Ivanov
aivanov at openjdk.org
Wed Sep 10 16:37:07 UTC 2025
On Wed, 10 Sep 2025 16:17:58 GMT, Weijun Wang <weijun at openjdk.org> wrote:
> Add HTML link processing ability in instructions. For example:
>
> PassFailJFrame.builder()
> .instructions(htmlWithLinks)
> .addHyperlinkListener(e -> {
> if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
> performActionOnLink(e.getDescription());
> }
> })
>
> I also take this chance to make a CSS change for fix-width text to show a light-gray background color.
Changes requested by aivanov (Reviewer).
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 657:
> 655: text.setBorder(createTextBorder());
> 656: text.setCaretPosition(0);
> 657: text.getCaret().setVisible(false);
Hiding the caret could be undesirable: if a tester wants to select text using keyboard, there's no way to see where the caret is.
The caret used to be hidden for read-only text components, now it's displayed by default but it doesn't blink, see [JDK-8299077](https://bugs.openjdk.org/browse/JDK-8299077).
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 1410:
> 1408: private int columns;
> 1409: private boolean screenCapture;
> 1410: HyperlinkListener hyperlinkListener;
Suggestion:
private boolean screenCapture;
private HyperlinkListener hyperlinkListener;
Declare it `private` for consistency.
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 1492:
> 1490:
> 1491: /**
> 1492: * Set the HyperlinkListener of links inside the instructions pane.
Suggestion:
* Sets a {@link HyperlinkListener} for navigating links inside the instructions pane.
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 1497:
> 1495: * @return this builder
> 1496: */
> 1497: public Builder addHyperlinkListener(HyperlinkListener hyperlinkListener) {
Suggestion:
public Builder hyperlinkListener(HyperlinkListener hyperlinkListener) {
For consistency with other methods.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27197#pullrequestreview-3206921872
PR Review Comment: https://git.openjdk.org/jdk/pull/27197#discussion_r2337288137
PR Review Comment: https://git.openjdk.org/jdk/pull/27197#discussion_r2337295581
PR Review Comment: https://git.openjdk.org/jdk/pull/27197#discussion_r2337295086
PR Review Comment: https://git.openjdk.org/jdk/pull/27197#discussion_r2337290962
More information about the client-libs-dev
mailing list