From a9cfe69ba76163aeb9df1f679e156fab6183cd10 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 13 May 2020 12:50:41 +0200 Subject: [PATCH] FileChooser: fixed missing labels in file chooser when running on Java 9 or later (issue #98) --- CHANGELOG.md | 2 + .../java/com/formdev/flatlaf/FlatLaf.java | 4 +- .../formdev/flatlaf/ui/FlatFileChooserUI.java | 15 ++++++ .../src/main/module-info/module-info.java | 2 + .../flatlaf/resources/Bundle.properties | 48 +++++++++++++++++++ .../flatlaf/resources/Bundle_de.properties | 48 +++++++++++++++++++ .../flatlaf/resources/Bundle_fr.properties | 48 +++++++++++++++++++ 7 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle.properties create mode 100644 flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle_de.properties create mode 100644 flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle_fr.properties diff --git a/CHANGELOG.md b/CHANGELOG.md index 141c8c11b..b25fd9cb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ FlatLaf Change Log `flatlaf-swingx-.jar`. - CheckBox and RadioButton: Flag `opaque` is no longer ignored when checkbox or radio button is used as table cell renderer. (issue #77) +- FileChooser: Fixed missing labels in file chooser when running on Java 9 or + later. (issue #98) ## 0.34 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java index 0dfcae616..78c948c8f 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java @@ -268,8 +268,8 @@ private void initializeAqua() { public UIDefaults getDefaults() { UIDefaults defaults = super.getDefaults(); - // add Metal resource bundle, which is required for FlatFileChooserUI - defaults.addResourceBundle( "com.sun.swing.internal.plaf.metal.resources.metal" ); + // add resource bundle for localized texts + defaults.addResourceBundle( "com.formdev.flatlaf.resources.Bundle" ); // initialize some defaults (for overriding) that are used in UI delegates, // but are not set in BasicLookAndFeel diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatFileChooserUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatFileChooserUI.java index 0736c33e0..5f92bf387 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatFileChooserUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatFileChooserUI.java @@ -86,6 +86,7 @@ * @uiDefault FileChooser.folderNameLabelText String * @uiDefault FileChooser.filesOfTypeLabelMnemonic String * @uiDefault FileChooser.filesOfTypeLabelText String + * * @uiDefault FileChooser.upFolderToolTipText String * @uiDefault FileChooser.upFolderAccessibleName String * @uiDefault FileChooser.homeFolderToolTipText String @@ -97,6 +98,20 @@ * @uiDefault FileChooser.detailsViewButtonToolTipText String * @uiDefault FileChooser.detailsViewButtonAccessibleName String * + * + * + * @uiDefault FileChooser.fileNameHeaderText String + * @uiDefault FileChooser.fileSizeHeaderText String + * @uiDefault FileChooser.fileTypeHeaderText String + * @uiDefault FileChooser.fileDateHeaderText String + * @uiDefault FileChooser.fileAttrHeaderText String + * + * @uiDefault FileChooser.viewMenuLabelText String + * @uiDefault FileChooser.refreshActionLabelText String + * @uiDefault FileChooser.newFolderActionLabelText String + * @uiDefault FileChooser.listViewActionLabelText String + * @uiDefault FileChooser.detailsViewActionLabelText String + * * @author Karl Tauber */ public class FlatFileChooserUI diff --git a/flatlaf-core/src/main/module-info/module-info.java b/flatlaf-core/src/main/module-info/module-info.java index 860d44237..e8e9dc4c3 100644 --- a/flatlaf-core/src/main/module-info/module-info.java +++ b/flatlaf-core/src/main/module-info/module-info.java @@ -26,5 +26,7 @@ exports com.formdev.flatlaf.ui; exports com.formdev.flatlaf.util; + opens com.formdev.flatlaf.resources; + uses com.formdev.flatlaf.FlatDefaultsAddon; } diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle.properties new file mode 100644 index 000000000..9ee3fb8fe --- /dev/null +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle.properties @@ -0,0 +1,48 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#---- FileChooser ---- + +#fields +FileChooser.lookInLabel.textAndMnemonic=Look &In: +FileChooser.saveInLabelText=Save In: +FileChooser.fileNameLabel.textAndMnemonic=File &Name: +FileChooser.folderNameLabel.textAndMnemonic=Folder &name: +FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &Type: + +# toolbar +FileChooser.upFolderToolTipText=Up One Level +FileChooser.upFolderAccessibleName=Up +FileChooser.homeFolderToolTipText=Home +FileChooser.homeFolderAccessibleName=Home +FileChooser.newFolderToolTipText=Create New Folder +FileChooser.newFolderAccessibleName=New Folder +FileChooser.listViewButtonToolTipText=List +FileChooser.listViewButtonAccessibleName=List +FileChooser.detailsViewButtonToolTipText=Details +FileChooser.detailsViewButtonAccessibleName=Details + +# details table header +FileChooser.fileNameHeaderText=Name +FileChooser.fileSizeHeaderText=Size +FileChooser.fileTypeHeaderText=Type +FileChooser.fileDateHeaderText=Modified +FileChooser.fileAttrHeaderText=Attributes + +# popup menu +FileChooser.viewMenuLabelText=View +FileChooser.refreshActionLabelText=Refresh +FileChooser.newFolderActionLabelText=New Folder +FileChooser.listViewActionLabelText=List +FileChooser.detailsViewActionLabelText=Details diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle_de.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle_de.properties new file mode 100644 index 000000000..f9034e761 --- /dev/null +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle_de.properties @@ -0,0 +1,48 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#---- FileChooser ---- + +#fields +FileChooser.lookInLabel.textAndMnemonic=Suchen &in: +FileChooser.saveInLabelText=Speichern in: +FileChooser.fileNameLabel.textAndMnemonic=&Dateiname: +FileChooser.folderNameLabel.textAndMnemonic=Ordner&name: +FileChooser.filesOfTypeLabel.textAndMnemonic=Datei&typ: + +# toolbar +FileChooser.upFolderToolTipText=Eine Ebene h\u00F6her +FileChooser.upFolderAccessibleName=Nach oben +FileChooser.homeFolderToolTipText=Home +FileChooser.homeFolderAccessibleName=Home +FileChooser.newFolderToolTipText=Neuen Ordner erstellen +FileChooser.newFolderAccessibleName=Neuer Ordner +FileChooser.listViewButtonToolTipText=Liste +FileChooser.listViewButtonAccessibleName=Liste +FileChooser.detailsViewButtonToolTipText=Details +FileChooser.detailsViewButtonAccessibleName=Details + +# details table header +FileChooser.fileNameHeaderText=Name +FileChooser.fileSizeHeaderText=Gr\u00F6\u00DFe +FileChooser.fileTypeHeaderText=Typ +FileChooser.fileDateHeaderText=\u00C4nderungsdatum +FileChooser.fileAttrHeaderText=Attribute + +# popup menu +FileChooser.viewMenuLabelText=Ansicht +FileChooser.refreshActionLabelText=Aktualisieren +FileChooser.newFolderActionLabelText=Neuer Ordner +FileChooser.listViewActionLabelText=Liste +FileChooser.detailsViewActionLabelText=Details diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle_fr.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle_fr.properties new file mode 100644 index 000000000..4e6477bac --- /dev/null +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/resources/Bundle_fr.properties @@ -0,0 +1,48 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#---- FileChooser ---- + +#fields +FileChooser.lookInLabel.textAndMnemonic=Rechercher &dans: +FileChooser.saveInLabelText=Enregistrer dans: +FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier: +FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier: +FileChooser.filesOfTypeLabel.textAndMnemonic=&Type de fichier: + +# toolbar +FileChooser.upFolderToolTipText=Remonte d'un niveau +FileChooser.upFolderAccessibleName=Monter +FileChooser.homeFolderToolTipText=R\u00E9pertoire de base +FileChooser.homeFolderAccessibleName=R\u00E9pertoire de base +FileChooser.newFolderToolTipText=Cr\u00E9e un dossier +FileChooser.newFolderAccessibleName=Nouveau dossier +FileChooser.listViewButtonToolTipText=Liste +FileChooser.listViewButtonAccessibleName=Liste +FileChooser.detailsViewButtonToolTipText=D\u00E9tails +FileChooser.detailsViewButtonAccessibleName=D\u00E9tails + +# details table header +FileChooser.fileNameHeaderText=Nom +FileChooser.fileSizeHeaderText=Taille +FileChooser.fileTypeHeaderText=Type +FileChooser.fileDateHeaderText=Modifi\u00E9 +FileChooser.fileAttrHeaderText=Attributs + +# popup menu +FileChooser.viewMenuLabelText=Affichage +FileChooser.refreshActionLabelText=Actualiser +FileChooser.newFolderActionLabelText=Nouveau dossier +FileChooser.listViewActionLabelText=Liste +FileChooser.detailsViewActionLabelText=D\u00E9tails