On Fri, 16 May 2025 23:04:28 GMT, Phil Race <[email protected]> wrote:
> Update the some code examples and accompanying images to no longer mention or
> display as applets.
src/java.desktop/share/classes/java/awt/BorderLayout.java line 103:
> 101: *
> 102: * <hr><blockquote><pre>
> 103: * import java.awt.BorderLayout;
Should we replace `<blockquote><pre>` with `{@snippet}` instead?
So, the sample could look like this:
* {@snippet lang='java':
* import java.awt.BorderLayout;
* // all the other code
* });
* }
* }
* }
The last `}` closes the `{@snippet}`, the previous `}` closes
`BorderLayoutExample` class.
I used `{@snippet}` in [`PassFailJFrame`
javadocs](https://github.com/openjdk/jdk/blob/972f2ebe978280d22531a70116e79837632f6ebc/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java#L166-L185),
and it looks like this in [the generated
javadoc](https://cr.openjdk.org/~aivanov/PassFailJFrame/api/PassFailJFrame.html#sampleManualTestCode)
with a *Copy* button embedded.
[Programmer's Guide to
Snippets](https://docs.oracle.com/en/java/javase/21/javadoc/snippets.html)
explains how to use this new javadoc feature available since Java 18
([JDK-8201533](https://bugs.openjdk.org/browse/JDK-8201533)).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25278#discussion_r2098758600