Browse Source

Demo: Only use files which have an svg extension

We need to require the dot or else we might try to load a folder as an icon.
pull/295/head
weisj 3 years ago committed by Jannis Weis
parent
commit
8019e61d50
  1. 2
      core/src/test/java/com/github/weisj/darklaf/icon/AllIcons.java

2
core/src/test/java/com/github/weisj/darklaf/icon/AllIcons.java

@ -99,7 +99,7 @@ public class AllIcons extends BaseComponentDemo {
protected static List<NamedIcon<? extends Icon>> loadIcons(final int displaySize, final boolean centered) { protected static List<NamedIcon<? extends Icon>> loadIcons(final int displaySize, final boolean centered) {
IconLoader loader = IconLoader.get(); IconLoader loader = IconLoader.get();
try (ResourceWalker walker = ResourceWalker.walkResources("com.github.weisj")) { try (ResourceWalker walker = ResourceWalker.walkResources("com.github.weisj")) {
return walker.stream().filter(p -> p.endsWith("svg")).map(p -> { return walker.stream().filter(p -> p.endsWith(".svg")).map(p -> {
ThemedSVGIcon icon = (ThemedSVGIcon) loader.loadSVGIcon(p, -displaySize, -displaySize, true); ThemedSVGIcon icon = (ThemedSVGIcon) loader.loadSVGIcon(p, -displaySize, -displaySize, true);
return new NamedIcon<>(p, centered ? new CenterIcon(icon, displaySize, displaySize) : icon); return new NamedIcon<>(p, centered ? new CenterIcon(icon, displaySize, displaySize) : icon);
}).collect(Collectors.groupingBy(pair -> pathToIconName(pair.getFirst()))) }).collect(Collectors.groupingBy(pair -> pathToIconName(pair.getFirst())))

Loading…
Cancel
Save