<Swing Dev> RFR: 8263454: com.apple.laf.AquaFileChooserUI ignores the result of String.trim() [v2]

Sergey Bylokhov serb at openjdk.java.net
Tue Mar 23 22:16:41 UTC 2021


On Tue, 23 Mar 2021 15:33:43 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java line 2059:
>> 
>>> 2057:             final String tooltipText = fc.getApproveButtonToolTipText();
>>> 2058:             if (tooltipText != null) {
>>> 2059:                 if (!tooltipText.isEmpty()) return tooltipText;
>> 
>> In other L&F like Metal, Basic even empty text is allowed.. there's no check for isEmpty()....Should we do the same here too?
>
> Yes, I think it would be better to allow to set empty text to conform with other LaF behavior.
> 
> Also `JFileChooser.getApproveButtonText()` and `JFileChooser.getApproveButtonToolTipText()` will now return correct values for empty strings.
> e.g. before the fix if we call `setApproveButtonText("")` subsequent call to `getApproveButtonText()` will return passed string, but in fact fallback string is used.
> 
> I've also labeled the issue with `noreg-hard`.

Is it possible to set an empty label in the native file chooser on macOS?

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

PR: https://git.openjdk.java.net/jdk/pull/3136


More information about the swing-dev mailing list