From 2a80405bbc76ca83a26d042d97f92853ce049ed1 Mon Sep 17 00:00:00 2001 From: weisj Date: Mon, 30 Mar 2020 20:57:26 +0200 Subject: [PATCH] Fixed wrongly printing a warning. Adjusted demos for new theme system. --- .../com/github/weisj/darklaf/theme/PropertyFontMapper.java | 2 +- core/src/test/java/ui/ComponentDemo.java | 4 +++- core/src/test/java/ui/tabFrame/TabFrameDemo.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/theme/PropertyFontMapper.java b/core/src/main/java/com/github/weisj/darklaf/theme/PropertyFontMapper.java index dcb6a18e..fd78c4f9 100644 --- a/core/src/main/java/com/github/weisj/darklaf/theme/PropertyFontMapper.java +++ b/core/src/main/java/com/github/weisj/darklaf/theme/PropertyFontMapper.java @@ -46,7 +46,7 @@ public class PropertyFontMapper implements FontMapper { adjustment = getSize(defaults); // No need to create a new font. if (adjustment == 0) return font; - if (adjustment < font.getSize2D()) { + if (adjustment + font.getSize2D() <= 0) { if (adjustment != Integer.MIN_VALUE) { LOGGER.warning("Font " + font + " would be invisible after applying " + "an adjustment of " + adjustment + ". Aborting!"); diff --git a/core/src/test/java/ui/ComponentDemo.java b/core/src/test/java/ui/ComponentDemo.java index 1a82ef4e..5c57e28f 100644 --- a/core/src/test/java/ui/ComponentDemo.java +++ b/core/src/test/java/ui/ComponentDemo.java @@ -33,7 +33,9 @@ import java.awt.event.ActionEvent; public interface ComponentDemo { static Theme getTheme() { - return new IntelliJTheme(); + return LafManager.themeForPreferredStyle(new PreferredThemeStyle(ContrastRule.STANDARD, + StyleRule.LIGHT, + FontSizeRule.DEFAULT)); } JComponent createComponent(); diff --git a/core/src/test/java/ui/tabFrame/TabFrameDemo.java b/core/src/test/java/ui/tabFrame/TabFrameDemo.java index 99213a31..c8e6ef78 100644 --- a/core/src/test/java/ui/tabFrame/TabFrameDemo.java +++ b/core/src/test/java/ui/tabFrame/TabFrameDemo.java @@ -48,7 +48,7 @@ public class TabFrameDemo implements ComponentDemo { private static Component createTextArea() { NumberedTextComponent numberPane = new NumberedTextComponent(new NonWrappingTextPane() {{ setText(StringUtil.repeat(DemoResources.LOREM_IPSUM, 10)); - setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14)); + setFont(new Font(Font.MONOSPACED, Font.PLAIN, getFont().getSize())); }}); NumberingPane numbering = numberPane.getNumberingPane(); Icon icon = IconLoader.get().getIcon("navigation/arrowRight.svg");