On Mon, 9 Jan 2023 10:24:49 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.

If the programmer uses, `CUSTOM_DIALOG`, they are responsible for setting the 
text and, if required, tooltip for the approve button, which is implied by the 
required `approveButtonText` parameter to 
[JFileChooser.html.showDialog](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/JFileChooser.html#showDialog(java.awt.Component,java.lang.String)).

As such, I don't think that adding a new entry to `UIManager` is the correct 
way to fix the bug.

If `JFileChooser` is added into a frame or another container without using its 
`show*` methods, you have to explicitly set the text for approve button using 
[`setApproveButtonText`](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/JFileChooser.html#setApproveButtonText(java.lang.String)).

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

PR: https://git.openjdk.org/jdk/pull/11901

Reply via email to