RFR: 8327924: Simplify TrayIconScalingTest.java [v2]

Alexey Ivanov aivanov at openjdk.org
Thu Mar 14 12:24:03 UTC 2024


On Thu, 14 Mar 2024 11:43:44 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> test/jdk/java/awt/TrayIcon/TrayIconScalingTest.java line 97:
>> 
>>> 95:                     .testTimeOut(8)
>>> 96:                     .rows(25)
>>> 97:                     .columns(70)
>> 
>> Personally I like rows+columns to immediately follow instructions,
>> but I'll approve anyway and let you decide.
>
> I haven't changed these lines, only indentation is changed because I moved it into `try` block.
> 
> I prefer keeping it as is so that these lines are attributed to Lawrence who modified the lines when he introduced the builder.

It would be good to get rid of `.rows` and `.columns` at all. I can't remember why using `JTextArea.getPreferredSize()` wasn't enough to size the instructions so that there are no scrollbars.

I submitted [JDK-8328163](https://bugs.openjdk.org/browse/JDK-8328163): _Implement automatic instruction sizing for PassFailJFrame_. Let's see if it's doable.

I saw some use `.rows((int) INSTRUCTIONS.lines().count() + 1)`, which implies the number of rows can be automatically calculated… up to a reasonable limit. The number of columns needed can also be estimated. I think `JTextArea.getPreferredSize()` should handle most cases.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18224#discussion_r1524742691


More information about the client-libs-dev mailing list