From c6a36374ab596fb6cd142cc57bf89d89584ff5b5 Mon Sep 17 00:00:00 2001 From: weisj <31143295+weisJ@users.noreply.github.com> Date: Wed, 8 Sep 2021 18:53:42 +0200 Subject: [PATCH] Settings: Replace smaller/larger text with icons In some languages the labels would overlap. Using icons solves this issue as only the default font size is marked with the text. Fixes #269 --- .../weisj/darklaf/settings/ThemeSettingsUI.java | 13 +++++++------ iconset/iconAccessorSpec.properties | 2 ++ .../darklaf/iconset/misc/decreaseFontSize.svg | 16 ++++++++++++++++ .../darklaf/iconset/misc/increaseFontSize.svg | 16 ++++++++++++++++ 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 iconset/src/main/resources/com/github/weisj/darklaf/iconset/misc/decreaseFontSize.svg create mode 100644 iconset/src/main/resources/com/github/weisj/darklaf/iconset/misc/increaseFontSize.svg diff --git a/core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettingsUI.java b/core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettingsUI.java index 0f47b980..f6626a02 100644 --- a/core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettingsUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettingsUI.java @@ -48,6 +48,7 @@ import com.github.weisj.darklaf.components.tooltip.ToolTipContext; import com.github.weisj.darklaf.components.tristate.TristateCheckBox; import com.github.weisj.darklaf.components.tristate.TristateState; import com.github.weisj.darklaf.graphics.ThemedColor; +import com.github.weisj.darklaf.iconset.AllIcons; import com.github.weisj.darklaf.listener.UIUpdater; import com.github.weisj.darklaf.platform.ThemePreferencesHandler; import com.github.weisj.darklaf.platform.macos.theme.MacOSColors; @@ -338,9 +339,9 @@ public class ThemeSettingsUI { Dictionary dict = fontSlider.createStandardLabels(tickSpacing); JLabel min = (JLabel) dict.get(fontSlider.getMinimum()); UIUpdater.registerComponent(min); - DynamicUI.withDynamic(min, - c -> c.setText(UIManager.getString("settings.label_font_smaller", fontSlider.getLocale()))); - min.setAlignmentX(JComponent.LEFT_ALIGNMENT); + min.setText(""); + min.setIcon(AllIcons.Action.DecreaseFontSize.get()); + min.setAlignmentX(JComponent.CENTER_ALIGNMENT); min.putClientProperty(DarkSliderUI.KEY_MANUAL_LABEL_ALIGN, true); JLabel mid = (JLabel) dict.get(fontSlider.getMinimum() + tickSpacing); @@ -355,9 +356,9 @@ public class ThemeSettingsUI { JLabel max = (JLabel) dict.get(fontSlider.getMaximum()); max.putClientProperty(DarkSliderUI.KEY_MANUAL_LABEL_ALIGN, true); - DynamicUI.withDynamic(max, - c -> c.setText(UIManager.getString("settings.label_font_bigger", fontSlider.getLocale()))); - max.setAlignmentX(JComponent.RIGHT_ALIGNMENT); + max.setText(""); + max.setIcon(AllIcons.Action.IncreaseFontSize.get()); + max.setAlignmentX(JComponent.CENTER_ALIGNMENT); max.putClientProperty(DarkSliderUI.KEY_MANUAL_LABEL_ALIGN, true); UIUpdater.registerComponent(max); diff --git a/iconset/iconAccessorSpec.properties b/iconset/iconAccessorSpec.properties index 5eb5325d..444f10b7 100644 --- a/iconset/iconAccessorSpec.properties +++ b/iconset/iconAccessorSpec.properties @@ -82,6 +82,8 @@ Action.Plus|disabled = misc/plusDisabled.svg Action.Minus = misc/minus.svg Action.Minus|selected = misc/minusSelected.svg Action.Minus|disabled = misc/minusDisabled.svg +Action.IncreaseFontSize = misc/increaseFontSize.svg +Action.DecreaseFontSize = misc/decreaseFontSize.svg Arrow.Thick.Down = navigation/arrow/thick/arrowDown.svg Arrow.Thick.Down|disabled = navigation/arrow/thick/arrowDownDisabled.svg diff --git a/iconset/src/main/resources/com/github/weisj/darklaf/iconset/misc/decreaseFontSize.svg b/iconset/src/main/resources/com/github/weisj/darklaf/iconset/misc/decreaseFontSize.svg new file mode 100644 index 00000000..3d852448 --- /dev/null +++ b/iconset/src/main/resources/com/github/weisj/darklaf/iconset/misc/decreaseFontSize.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/iconset/src/main/resources/com/github/weisj/darklaf/iconset/misc/increaseFontSize.svg b/iconset/src/main/resources/com/github/weisj/darklaf/iconset/misc/increaseFontSize.svg new file mode 100644 index 00000000..6f7d2d6a --- /dev/null +++ b/iconset/src/main/resources/com/github/weisj/darklaf/iconset/misc/increaseFontSize.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + +