From da23a880b1877b412e52724eb1b0fe3d39ee0106 Mon Sep 17 00:00:00 2001 From: weisj Date: Tue, 11 Feb 2020 00:00:02 +0100 Subject: [PATCH] Moved icon loading message to where the icon is actually loaded. Signed-off-by: weisj --- .../java/com/github/weisj/darklaf/icons/DarkSVGIcon.java | 5 +++++ src/main/java/com/github/weisj/darklaf/icons/IconLoader.java | 1 - src/main/java/com/github/weisj/darklaf/icons/LazyIcon.java | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/weisj/darklaf/icons/DarkSVGIcon.java b/src/main/java/com/github/weisj/darklaf/icons/DarkSVGIcon.java index 186a6f4e..8f95636c 100644 --- a/src/main/java/com/github/weisj/darklaf/icons/DarkSVGIcon.java +++ b/src/main/java/com/github/weisj/darklaf/icons/DarkSVGIcon.java @@ -30,9 +30,11 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; import java.awt.geom.AffineTransform; +import java.io.File; import java.io.Serializable; import java.net.URI; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.logging.Logger; /** * Icon from SVG image. @@ -42,6 +44,7 @@ import java.util.concurrent.atomic.AtomicBoolean; */ public class DarkSVGIcon implements Icon, Serializable { + private static final Logger LOGGER = Logger.getLogger(DarkSVGIcon.class.getName()); private final Dimension size; private final SVGIcon icon; private final URI uri; @@ -87,6 +90,8 @@ public class DarkSVGIcon implements Icon, Serializable { private void ensureLoaded() { if (!loaded.get()) { + File file = new File(uri); + LOGGER.info("Loading icon '" + file.getName() + "'."); icon.setSvgURI(uri); loaded.set(true); } diff --git a/src/main/java/com/github/weisj/darklaf/icons/IconLoader.java b/src/main/java/com/github/weisj/darklaf/icons/IconLoader.java index 3dd43042..04303976 100644 --- a/src/main/java/com/github/weisj/darklaf/icons/IconLoader.java +++ b/src/main/java/com/github/weisj/darklaf/icons/IconLoader.java @@ -136,7 +136,6 @@ public final class IconLoader { @NotNull public Icon loadSVGIcon(@NotNull final String name, final int w, final int h, final boolean themed) { try { - LOGGER.info("Loading icon '" + name + "'. Resolving from " + parentClass); if (themed) { return new ThemedSVGIcon(Objects.requireNonNull(parentClass.getResource(name).toURI()), w, h); } else { diff --git a/src/main/java/com/github/weisj/darklaf/icons/LazyIcon.java b/src/main/java/com/github/weisj/darklaf/icons/LazyIcon.java index acd3de4c..b0d920ec 100644 --- a/src/main/java/com/github/weisj/darklaf/icons/LazyIcon.java +++ b/src/main/java/com/github/weisj/darklaf/icons/LazyIcon.java @@ -28,12 +28,14 @@ import org.jetbrains.annotations.Contract; import javax.swing.*; import javax.swing.plaf.UIResource; import java.awt.*; +import java.util.logging.Logger; /** * @author Jannis Weis */ public abstract class LazyIcon implements Icon, UIResource { + private static final Logger LOGGER = Logger.getLogger(LazyIcon.class.getName()); protected final String path; protected final IconLoader.IconKey key; protected final Class parentClass; @@ -55,6 +57,7 @@ public abstract class LazyIcon implements Icon, UIResource { private void ensureLoaded() { if (!loaded) { + LOGGER.info("Loading icon '" + path + "'. Resolving from " + parentClass); icon = loadIcon(); loaded = true; if (icon == null) {