On Thu, 12 Jan 2023 06:06:32 GMT, Tejesh R <[email protected]> wrote:
>> FileChooser Open/Approve button size is shown incorrectly when no Approve
>> button text is set in `CUSTOM_DIALOG` type. Reason being that no default
>> Approve Button text is returned during Dialog Type Property change. Since
>> `null` is returned as Button string the Button size is incorrectly shown.
>> The fix here addresses the issue by adding a default Approve Button Text
>> when no text is set explicitly in case of `CUSTOM_DIALOG` type.
>> Automated test is attached which has been tested with multiple test runs.
>
> Tejesh R has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Updated based on review comments
test/jdk/javax/swing/JFileChooser/CustomApproveButtonTest.java line 80:
> 78: if (customApproveButton == null) {
> 79: fail("Cannot find Custom Approve Button in FileChooser!");
> 80: return;
Suggestion:
throw new RuntimeException("Cannot find Approve button in
FileChooser!");
It's just an Approve button.
Now that frame is disposed of separately, there's no need for `fail` method —
throw the exception.
test/jdk/javax/swing/JFileChooser/CustomApproveButtonTest.java line 83:
> 81: }
> 82: if (customApproveButton.getText() == null) {
> 83: fail("Custom Approve Button Text is null in
> FileChooser!");
Suggestion:
fail("Approve button text is null in FileChooser!");
test/jdk/javax/swing/JFileChooser/CustomApproveButtonTest.java line 97:
> 95: }
> 96:
> 97: private void setLookAndFeel(String laf) {
It can be `static` since it doesn't use any fields of the class.
-------------
PR: https://git.openjdk.org/jdk/pull/11901