-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing label in file chooser #98
Comments
Strange. The labels are there when running on Java 8, but not when running on Java 9 or later... |
FlatFileChooserUI extends MetalFileChooserUI. In MetalFileChooserUI, resources are read from UIManager with keys like "FileChooser.lookInLabelText", "FileChooser.filesOfTypeLabelText". Where are these defined in FlatLaf? |
OK, I understand the problem:
So, the "[java.desktop]/com/sun/swing/internal/plaf/metal/resources/metal*" resource bundle is not loaded. Several keys needed by MetalFileChooserUI are missing. Unless I am mistaken, resource bundles are loaded using "UIDefaults.addInternalBundle(bundleName);" which is tagged I guess that using a MetalXxxUI is risky if the look and feel does not extend MetalLookAndFeel. Otherwise code may break for changes in keys between Java versions. |
@Chrriis you're right. The missing texts are in Metal Laf resource bundle. They are loaded in FlatLaf with: FlatLaf/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java Lines 271 to 272 in d3a70b8
Unfortunately this works only for Java 8, but not for Java 9+ because it is a internal file. So have to add own file chooser texts to FlatLaf... |
fixed in master branch |
Yes, it does the job! Now conceptually, I think this is not perfect: if in the next version of Java the mechanism changes, the library would break due to the desynchronisation of FlatFileChooserUI (extends MetalFileChooserUI) and FlatLaf (extends BasicLookAndFeel). The clean (and naive?) solution would be to either have FlatLaf extend MetalLookAndFeel or FlatFileChooserUI to extend BasicFileChooserUI. But either might be a lot of work or creating more problems? |
It would be great if FlatLaf had its own FlatFileChooserUI, but I know it would be a lot of work. The source for MetalFileChooserUI contains the following comment:
That's been there a long time. I'm guessing it's not happening :-/ |
Don't think it is a problem to use Basing FlatLaf on Metal just for the file chooser is definitely no option. Implementing an own file chooser is a lot of work, but an option for later. |
It seems the labels for the 2 bottom fields are missing. It is confusing.
Here, for a folder file chooser, I have "Folder name:" and "Files of type:" labels on Windows:
But I get empty labels in FlatLaf:
The text was updated successfully, but these errors were encountered: