RFR: 8357176: java.awt javadoc code examples still use Applet API

Phil Race prr at openjdk.org
Tue May 20 19:30:54 UTC 2025


On Mon, 19 May 2025 12:44:35 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Update the some code examples and accompanying images to no longer mention or display as applets.
>
> src/java.desktop/share/classes/java/awt/GridBagLayout.java line 243:
> 
>> 241:  * right-to-left container.
>> 242:  *
>> 243:  * <div style="margin:0 auto;width:850px;text-align:center;font-weight:bold">
> 
> Is it possible to keep the width small as it was?

I doubt it - unless you make the font really small, maybe?
If you look at how it is today you'll see the buttons are packed together using Motif L&F
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/awt/GridBagLayout.html
BTW I tried a couple of times to upload javadoc to cr.openjdk.org so I could show the new rendered javadoc but uploads failed ...

> src/java.desktop/share/classes/java/awt/GridBagLayout.java line 288:
> 
>> 286:  * public class GridBagLayoutExample {
>> 287:  *
>> 288:  *  static void addButton(String name,
> 
> Suggestion:
> 
>  *  private static void addButton(String name,

ok ...

> src/java.desktop/share/classes/java/awt/GridBagLayout.java line 295:
> 
>> 293:  *     gridbag.setConstraints(button, c);
>> 294:  *     frame.add(button);
>> 295:  *  }
> 
> The `add` method should indented by 4 spaces to the right.

adjusting

> src/java.desktop/share/classes/java/awt/GridBagLayout.java line 303:
> 
>> 301:  *       GridBagLayout gridbag = new GridBagLayout();
>> 302:  *       GridBagConstraints c = new GridBagConstraints();
>> 303:  *       frame.setLayout(gridbag);
> 
> The `main` method should be indented by 4 spaces to the right, it's inside `GridBagLayoutExample` class.

will adjust

> src/java.desktop/share/classes/java/awt/MediaTracker.java line 108:
> 
>> 106:  *          tracker.addImage(bg, 0);
>> 107:  *          for (int i = 0; i < 5; i++) {
>> 108:  *              anim[i] = tk.getImage("anim"+i+".gif");
> 
> Suggestion:
> 
>  *              anim[i] = tk.getImage("anim" + i + ".gif");

ok ...

> src/java.desktop/share/classes/java/awt/doc-files/BorderLayout-1.png line 1:
> 
>> 1: �PNG
> 
> The images would look better with square borders… which are left on Windows 10 only.
> 
> If it's possible to make the pixels on the rounded corners transparent or at least white, the images would look better.

I did not feel like getting into manual touch up of these images. In some cases they are a massive improvement over what was there before regardless eg this is how FlowLayout looks today
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/awt/doc-files/FlowLayout-1.gif

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25278#discussion_r2098687639
PR Review Comment: https://git.openjdk.org/jdk/pull/25278#discussion_r2098711963
PR Review Comment: https://git.openjdk.org/jdk/pull/25278#discussion_r2098711724
PR Review Comment: https://git.openjdk.org/jdk/pull/25278#discussion_r2098711524
PR Review Comment: https://git.openjdk.org/jdk/pull/25278#discussion_r2098712376
PR Review Comment: https://git.openjdk.org/jdk/pull/25278#discussion_r2098711098


More information about the client-libs-dev mailing list