Merge pull request #421 from weisJ/modern-icons

Provide more modern icons
This commit is contained in:
Konloch 2022-04-28 13:22:25 -07:00 committed by GitHub
commit 5be55df6c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 559 additions and 169 deletions

View File

@ -28,7 +28,7 @@
<commons-io.version>2.11.0</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-text.version>1.9</commons-text.version>
<darklaf.version>3.0.0</darklaf.version>
<darklaf.version>3.0.1-SNAPSHOT</darklaf.version>
<darklaf-extensions-rsta.version>0.4.1</darklaf-extensions-rsta.version>
<decompiler-fernflower.version>5.2.1.Final</decompiler-fernflower.version>
<dex2jar.version>v49</dex2jar.version>
@ -66,6 +66,10 @@
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>

View File

@ -1,8 +1,15 @@
package the.bytecode.club.bytecodeviewer.gui.components;
import javax.swing.Icon;
import com.github.weisj.darklaf.components.RotatableIconAnimator;
import com.github.weisj.darklaf.components.loading.LoadingIndicator;
import com.github.weisj.darklaf.iconset.AllIcons;
import com.github.weisj.darklaf.properties.icons.RotatableIcon;
import the.bytecode.club.bytecodeviewer.resources.IconResources;
import java.awt.event.*;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
@ -27,17 +34,20 @@ import the.bytecode.club.bytecodeviewer.resources.IconResources;
*/
public class WaitBusyIcon extends JMenuItemIcon
{
private final RotatableIconAnimator animator;
public WaitBusyIcon()
{
super(loadIcon());
setAlignmentY(0.65f);
}
public static Icon loadIcon()
{
if(IconResources.busyIcon != null)
return IconResources.busyIcon;
return IconResources.busyB64Icon;
super(new RotatableIcon(IconResources.busyIcon));
animator = new RotatableIconAnimator(8, (RotatableIcon) getIcon(), this);
addHierarchyListener(e -> {
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0)
{
if (getParent() == null)
animator.stop();
else
animator.start();
}
});
}
}

View File

@ -5,8 +5,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JTree;
import javax.swing.*;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeNode;
import org.apache.commons.io.FilenameUtils;
@ -21,7 +20,7 @@ import the.bytecode.club.bytecodeviewer.resources.ResourceType;
public class ResourceListIconRenderer extends DefaultTreeCellRenderer
{
//TODO the icon cache needs to be cleared on treenode removal
public static Map<ResourceTreeNode, ImageIcon> iconCache = new HashMap<>();
public static Map<ResourceTreeNode, Icon> iconCache = new HashMap<>();
//called every time there is a pane update
@Override
@ -134,7 +133,7 @@ public class ResourceListIconRenderer extends DefaultTreeCellRenderer
return ret;
}
public void cacheNodeIcon(ResourceTreeNode node, ImageIcon icon)
public void cacheNodeIcon(ResourceTreeNode node, Icon icon)
{
iconCache.put(node, icon);
setIcon(icon);

View File

@ -26,6 +26,7 @@ import org.apache.commons.io.FilenameUtils;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;
import the.bytecode.club.bytecodeviewer.gui.contextmenu.ContextMenu;
import the.bytecode.club.bytecodeviewer.resources.IconResources;
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
import the.bytecode.club.bytecodeviewer.resources.importing.Import;
import the.bytecode.club.bytecodeviewer.translation.TranslatedComponents;
@ -72,8 +73,8 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File
public final JPopupMenu rightClickMenu = new JPopupMenu();
public final JCheckBox exact = new TranslatedJCheckBox("Exact path", TranslatedComponents.EXACT_PATH);
public final JCheckBox caseSensitive = new TranslatedJCheckBox("Match case", TranslatedComponents.MATCH_CASE);
public final JButton open = new JButton("+");
public final JButton close = new JButton("-");
public final JButton open = new JButton(IconResources.add);
public final JButton close = new JButton(IconResources.remove);
public final ResourceTreeNode treeRoot = new ResourceTreeNode("Loaded Files:");
public final ResourceTree tree = new ResourceTree(treeRoot);
public final JTextField quickSearch = new TranslatedJTextField("Quick file search (no file extension)", TranslatedComponents.QUICK_FILE_SEARCH_NO_FILE_EXTENSION);

View File

@ -2,17 +2,17 @@ package the.bytecode.club.bytecodeviewer.gui.theme;
import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.listener.UIUpdater;
import com.github.weisj.darklaf.theme.DarculaTheme;
import com.github.weisj.darklaf.theme.HighContrastDarkTheme;
import com.github.weisj.darklaf.theme.HighContrastLightTheme;
import com.github.weisj.darklaf.theme.IntelliJTheme;
import com.github.weisj.darklaf.theme.OneDarkTheme;
import com.github.weisj.darklaf.theme.SolarizedDarkTheme;
import com.github.weisj.darklaf.theme.SolarizedLightTheme;
import com.github.weisj.darklaf.properties.icons.IconLoader;
import com.github.weisj.darklaf.theme.*;
import java.awt.*;
import java.util.Properties;
import javax.swing.*;
import javax.swing.text.JTextComponent;
import com.github.weisj.darklaf.theme.info.PresetIconRule;
import com.github.weisj.darklaf.theme.spec.ColorToneRule;
import org.checkerframework.checker.guieffect.qual.UI;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.gui.components.SettingsDialog;
@ -134,11 +134,18 @@ public enum LAFTheme
LafManager.install(new HighContrastLightTheme());
break;
}
//test theme installed correctly
if(darkLAF)
failSafe();
if (!LafManager.isInstalled())
{
setupIconColors();
// Invalidate themed icons
IconLoader.updateThemeStatus(new Object());
}
Configuration.showDarkLAFComponentIcons = darkLAF;
if(BytecodeViewer.viewer != null)
@ -157,7 +164,7 @@ public enum LAFTheme
SettingsDialog.dialogs.forEach(Dialog::dispose);
}
}
/**
* Attempts to failsafe by forcing an error before the mainviewer is called.
* It then defaults to the system theme
@ -184,4 +191,52 @@ public enum LAFTheme
UIUpdater.registerComponent(comp);
}
}
private void setupIconColors()
{
Properties properties = new Properties();
JTextComponent colorTemplateComponent = new JTextField();
properties.put("textForeground", colorTemplateComponent.getForeground());
colorTemplateComponent.setEnabled(false);
properties.put("textForegroundInactive", colorTemplateComponent.getForeground());
properties.put("textSelectionForeground", colorTemplateComponent.getSelectedTextColor());
new LightIconThemeSupplier().loadIconTheme(properties, UIManager.getDefaults(), IconLoader.get());
UIManager.getLookAndFeelDefaults().putAll(properties);
}
private static class LightIconThemeSupplier extends Theme
{
@Override
protected PresetIconRule getPresetIconRule()
{
return PresetIconRule.LIGHT;
}
@Override
public String getPrefix()
{
return "DO NOT USE";
}
@Override
public String getName()
{
return getPrefix();
}
@Override
protected Class<? extends Theme> getLoaderClass()
{
return LightIconThemeSupplier.class;
}
@Override
public ColorToneRule getColorToneRule()
{
return ColorToneRule.LIGHT;
}
}
}

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import org.apache.commons.io.FilenameUtils;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.resources.IconResources;
import the.bytecode.club.bytecodeviewer.resources.Resource;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -46,7 +47,7 @@ public enum PluginTemplate
public String getContents() throws IOException
{
if(contents == null)
contents = IconResources.loadResourceAsString(resourcePath);
contents = Resource.loadResourceAsString(resourcePath);
return contents;
}

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,12 @@
package the.bytecode.club.bytecodeviewer.resources;
import org.apache.commons.io.IOUtils;
import org.objectweb.asm.tree.ClassNode;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
@ -36,6 +41,15 @@ public class Resource
this.workingName = workingName;
this.container = container;
}
public static String loadResourceAsString(String resourcePath) throws IOException
{
try (InputStream is = IconResources.class.getResourceAsStream(resourcePath)) {
if (is == null)
return null;
return IOUtils.toString(is, StandardCharsets.UTF_8);
}
}
/**
* Returns the resource bytes from the resource container

View File

@ -2,7 +2,7 @@ package the.bytecode.club.bytecodeviewer.resources;
import java.util.HashMap;
import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.*;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -53,7 +53,7 @@ public enum ResourceType
public static final Map<String, ResourceType> imageExtensionMap = new HashMap<>();
public static final Map<String, ResourceType> supportedBCVExtensionMap = new HashMap<>();
private final ImageIcon icon;
private final Icon icon;
private final String[] extensions;
//private final byte[][] headerMagicNumber;
@ -79,13 +79,13 @@ public enum ResourceType
supportedBCVExtensionMap.put(extension, ANDROID_ARCHIVE);
}
ResourceType(ImageIcon icon, String... extensions)
ResourceType(Icon icon, String... extensions)
{
this.icon = icon;
this.extensions = extensions;
}
public ImageIcon getIcon()
public Icon getIcon()
{
return icon;
}

View File

@ -14,6 +14,7 @@ import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Constants;
import the.bytecode.club.bytecodeviewer.api.BCV;
import the.bytecode.club.bytecodeviewer.resources.IconResources;
import the.bytecode.club.bytecodeviewer.resources.Resource;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -158,7 +159,7 @@ public enum Language
if(translationMap == null)
{
translationMap = BytecodeViewer.gson.fromJson(
IconResources.loadResourceAsString(resourcePath),
Resource.loadResourceAsString(resourcePath),
new TypeToken<HashMap<String, String>>() {}.getType());
}
@ -178,7 +179,7 @@ public enum Language
return;
LinkedMap<String, String> translationMap = BytecodeViewer.gson.fromJson(
IconResources.loadResourceAsString(resourcePath),
Resource.loadResourceAsString(resourcePath),
new TypeToken<LinkedMap<String, String>>(){}.getType());
Set<String> existingKeys = new HashSet<>();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,20 @@
<svg height="16" width="16" viewBox="0 0 48 48" version="1.1" id="svg30" xmlns="http://www.w3.org/2000/svg">
<g id="_14-Android" transform="translate(1.418 1.419) scale(.9409)">
<path fill="#2ebc70" d="M14 7a1 1 0 0 1-.707-.293l-4-4a1 1 0 0 1 1.414-1.414l4 4A1 1 0 0 1 14 7z" id="path8"/>
<path fill="#2ebc70" d="M34 7a1 1 0 0 1-.707-1.707l4-4a1 1 0 0 1 1.414 1.414l-4 4A1 1 0 0 1 34 7z" id="path10"/>
<g id="_Group_">
<circle fill="#f1f2f2" cx="28" cy="10" r="2" id="circle12"/>
<circle fill="#f1f2f2" cx="20" cy="10" r="2" id="circle14"/>
<path fill="#35dc86"
d="M38 34v3a2.006 2.006 0 0 1-2 2h-3v6a2.006 2.006 0 0 1-2 2h-2a2.006 2.006 0 0 1-2-2v-6h-6v6a2.006 2.006 0 0 1-2 2h-2a2.006 2.006 0 0 1-2-2v-6h-3a2.006 2.006 0 0 1-2-2v-3H7a.979.979 0 0 1-1-1V23a1.959 1.959 0 0 1 2-2h32a1.959 1.959 0 0 1 2 2v10a.979.979 0 0 1-1 1z"
id="path16"/>
<path fill="#35dc86"
d="M38 16v2H10v-2a14 14 0 0 1 28 0zm-8-6a2 2 0 1 0-2 2 2.006 2.006 0 0 0 2-2zm-8 0a2 2 0 1 0-2 2 2.006 2.006 0 0 0 2-2z"
id="path18"/>
<path fill="#2ebc70" d="M8 21a1.959 1.959 0 0 0-2 2v10a.979.979 0 0 0 1 1h3V21z" id="path20"/>
<path fill="#2ebc70" d="M40 21h-2v13h3a.979.979 0 0 0 1-1V23a1.959 1.959 0 0 0-2-2z" id="path22"/>
<path fill="#2ebc70" d="M20 13a3 3 0 1 1 3-3 3 3 0 0 1-3 3zm0-4a1 1 0 1 0 1 1 1 1 0 0 0-1-1z" id="path24"/>
<path fill="#2ebc70" d="M28 13a3 3 0 1 1 3-3 3 3 0 0 1-3 3zm0-4a1 1 0 1 0 1 1 1 1 0 0 0-1-1z" id="path26"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,37 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="fileIconBackground"
fallback="Label.foreground" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#9AA7B0" stop-opacity=".8"/>
<stop offset="1" stop-color="#9AA7B0" stop-opacity=".8"/>
</linearGradient>
<linearGradient id="menuIconHighlight"
fallback="textHighlight,%#0000FF">
<stop offset="0" stop-color="#40B6E0"/>
<stop offset="1" stop-color="#40B6E0"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<g fill="url(#fileIconBackground)">
<polygon points="6 1 3 1 3 5 3 15 6 15"/>
<polygon points="10 15 13 15 13 1 10 1"/>
</g>
<g fill="url(#menuIconHighlight)">
<polygon points="7.6 2 6 2 6.8 3 8.401 3"/>
<polygon points="7.6 8 6 8 6.8 9 8.401 9"/>
<polygon points="7.6 10 6 10 6.8 11 8.401 11"/>
<polygon points="7.6 12 6 12 6.8 13 8.401 13"/>
<polygon points="7.6 14 6 14 6.8 15 8.401 15"/>
<polygon points="7.6 4 6 4 6.8 5 8.401 5"/>
<polygon points="7.6 6 6 6 6.8 7 8.401 7"/>
<polygon points="8.4 3 10 3 9.2 4 7.599 4"/>
<polygon points="8.4 1 10 1 9.2 2 7.599 2"/>
<polygon points="8.4 9 10 9 9.2 10 7.599 10"/>
<polygon points="8.4 11 10 11 9.2 12 7.599 12"/>
<polygon points="8.4 13 10 13 9.2 14 7.599 14"/>
<polygon points="8.4 5 10 5 9.2 6 7.599 6"/>
<polygon points="8.4 7 10 7 9.2 8 7.599 8"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

View File

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 13 13">
<defs id="colors">
<linearGradient id="menuIconEnabled"
fallback="Label.foreground">
<stop offset="0" stop-color="#AFB1B3" />
<stop offset="1" stop-color="#AFB1B3" />
</linearGradient>
</defs>
<path fill="url(#menuIconEnabled)" fill-rule="evenodd" d="M5.42776692,4.59066026 L3.30710669,2.47000003 L2.5999999,3.17710681 L4.72066014,5.29776704 L2.5999999,7.41842728 L3.30710669,8.12553406 L5.42776692,6.00487382 L5.42842703,6.00553393 L6.13553381,5.29842715 L6.1348737,5.29776704 L6.13553381,5.29710693 L5.42842703,4.59000015 L5.42776692,4.59066026 Z M1,1 L12,1 L12,11 L1,11 L1,1 Z M6,8 L6,9 L10,9 L10,8 L6,8 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 B

View File

@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="fileIconBackground"
fallback="Label.foreground" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#9AA7B0" stop-opacity=".8"/>
<stop offset="1" stop-color="#9AA7B0" stop-opacity=".8"/>
</linearGradient>
<linearGradient id="menuIconHighlight"
fallback="textHighlight,%#0000FF">
<stop offset="0" stop-color="#40B6E0" />
<stop offset="1" stop-color="#40B6E0" />
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<polygon fill="url(#fileIconBackground)" points="7 1 3 5 7 5"/>
<path fill="url(#fileIconBackground)" d="M7.99940849,14.9997 L3.0004,14.9997 L3.0004,5.9997 L8.0004,5.9997 L8.0004,0.9997 L13.0004,0.9997 L13.0004,6.9997 L13.0004,7.10009933 C12.6771661,7.03445868 12.3426072,7 12,7 C9.23857625,7 7,9.23857625 7,12 C7,13.1254712 7.37185581,14.1640909 7.99940849,14.9997 Z"/>
<path fill="url(#menuIconHighlight)" d="M14.9038963,12.5790317 L15.8135595,13.2316899 C15.6384896,13.7731744 15.3510977,14.2641457 14.9788518,14.6771359 L13.9588158,14.2169755 C13.668497,14.4727984 13.3275303,14.6724899 12.9528891,14.7990766 L12.8417488,15.9127236 C12.5724461,15.9699115 12.2931267,16 12.0067798,16 C11.7204328,16 11.4411134,15.9699115 11.1718107,15.9127236 L11.0606704,14.7990765 C10.6860293,14.6724898 10.3450626,14.4727983 10.0547438,14.2169754 L9.03470769,14.6771359 C8.66246178,14.2641457 8.37506991,13.7731744 8.2,13.2316899 L9.10966347,12.5790315 C9.07244924,12.3917905 9.05293363,12.1981744 9.05293363,12.0000001 C9.05293363,11.8018258 9.07244926,11.6082096 9.10966352,11.4209686 L8.2,10.7683101 C8.37506991,10.2268256 8.66246178,9.73585432 9.03470769,9.32286405 L10.0547441,9.78302467 C10.3450628,9.52720191 10.6860293,9.32751047 11.0606704,9.20092378 L11.1718107,8.08727644 C11.4411134,8.03008853 11.7204328,8 12.0067798,8 C12.2931267,8 12.5724461,8.03008853 12.8417488,8.08727644 L12.9528891,9.20092368 C13.3275302,9.32751034 13.6684969,9.5272018 13.9588156,9.78302459 L14.9788518,9.32286405 C15.3510977,9.73585432 15.6384896,10.2268256 15.8135595,10.7683101 L14.9038962,11.4209684 C14.9411105,11.6082095 14.9606262,11.8018258 14.9606262,12.0000001 C14.9606262,12.1981744 14.9411105,12.3917906 14.9038963,12.5790317 Z M12.0067796,13.4156281 C12.7884749,13.4156281 13.4221642,12.7818843 13.4221642,12.0001217 C13.4221642,11.2183591 12.7884749,10.5846153 12.0067796,10.5846153 C11.2250843,10.5846153 10.591395,11.2183591 10.591395,12.0001217 C10.591395,12.7818843 11.2250843,13.4156281 12.0067796,13.4156281 Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,33 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="fileIconBackground"
fallback="Label.foreground" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#9AA7B0" stop-opacity=".8"/>
<stop offset="1" stop-color="#9AA7B0" stop-opacity=".8"/>
</linearGradient>
<linearGradient id="palette.purple"
fallback="%#B99BF8">
<stop offset="0" stop-color="#B99BF8"/>
<stop offset="1" stop-color="#B99BF8"/>
</linearGradient>
<linearGradient id="fileIconForeground"
fallback="Label.background" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#231F20" stop-opacity=".8"/>
<stop offset="1" stop-color="#231F20" stop-opacity=".8"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<polygon fill="url(#palette.purple)" fill-opacity=".7" points="1 16 16 16 16 9 1 9"/>
<polygon fill="url(#fileIconBackground)" points="7 1 3 5 7 5"/>
<polygon fill="url(#fileIconBackground)" points="8 1 8 6 3 6 3 8 13 8 13 1"/>
<path fill="url(#fileIconForeground)"
d="M0,2.501 C0,1 0.931,2.02832126e-16 2.256,0 C3.20239258,0 3.55,0.311 3.969,0.753 L3.42669678,1.42712402 C3.07669678,1.06812402 2.75,1 2.25,1 C1.418,1 1,1.73791504 1,2.487 C1,3.23608496 1.412,4 2.25,4 C2.787,4 3.05169678,3.89340869 3.42669678,3.50640869 L4,4.144 C3.544,4.669 3.19732666,5 2.225,5 C0.949,5 7.35277938e-17,4.002 0,2.501 Z"
transform="translate(3 10)"/>
<path fill="url(#fileIconForeground)" d="M2,1 L3,1 L3,2 L2,2 L2,3 L1,3 L1,2 L0,2 L0,1 L1,1 L1,0 L2,0 L2,1 Z"
transform="translate(8 11)"/>
<path fill="url(#fileIconForeground)" d="M2,1 L3,1 L3,2 L2,2 L2,3 L1,3 L1,2 L0,2 L0,1 L1,1 L1,0 L2,0 L2,1 Z"
transform="translate(12 11)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,31 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="fileIconBackground"
fallback="Label.foreground" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#9AA7B0" stop-opacity=".8"/>
<stop offset="1" stop-color="#9AA7B0" stop-opacity=".8"/>
</linearGradient>
<linearGradient id="palette.green"
fallback="%#28CD41">
<stop offset="0" stop-color="#28CD41" />
<stop offset="1" stop-color="#28CD41" />
</linearGradient>
<linearGradient id="fileIconForeground"
fallback="Label.background" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#231F20" stop-opacity=".8"/>
<stop offset="1" stop-color="#231F20" stop-opacity=".8"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<polygon fill="url(#palette.green)" fill-opacity=".7" points="1 16 16 16 16 9 1 9"/>
<polygon fill="url(#fileIconBackground)" points="7 1 3 5 7 5"/>
<polygon fill="url(#fileIconBackground)" points="8 1 8 6 3 6 3 8 13 8 13 1"/>
<path fill="url(#fileIconForeground)"
d="M0,2.501 C0,1 0.931,2.02832126e-16 2.256,0 C3.20239258,0 3.55,0.311 3.969,0.753 L3.42669678,1.42712402 C3.07669678,1.06812402 2.75,1 2.25,1 C1.418,1 1,1.73791504 1,2.487 C1,3.23608496 1.412,4 2.25,4 C2.787,4 3.05169678,3.89340869 3.42669678,3.50640869 L4,4.144 C3.544,4.669 3.19732666,5 2.225,5 C0.949,5 7.35277938e-17,4.002 0,2.501 Z"
transform="translate(3 10)"/>
<path transform="translate(3,0)" fill="url(#fileIconForeground)" fill-rule='evenodd'
d='M8,13L7,13L7,12L8,12M10,12L10,11L9,11L9,10L8,10L8,11L7,11L7,10L6,10L6,11L5,11L5,12L6,12L6,13L5,13L5,14L6,14L6,15L7,15L7,14L8,14L8,15L9,15L9,14L10,14L10,13L9,13L9,12L10,12Z'/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 570 B

View File

@ -0,0 +1,23 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="fileIconBackground"
fallback="Label.foreground" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#9AA7B0" stop-opacity=".8"/>
<stop offset="1" stop-color="#9AA7B0" stop-opacity=".8"/>
</linearGradient>
<linearGradient id="palette.orange"
fallback="%#D9A343">
<stop offset="0" stop-color="#D9A343"/>
<stop offset="1" stop-color="#D9A343"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<path fill="url(#fileIconBackground)"
d="M7.98462,4 L6.69629,2.71143 C6.22158519,2.28563452 5.61574625,2.0346507 4.979,2 L1.05127,2 C1.037675,1.99999735 1.02463577,2.0053954 1.01502078,2.01500664 C1.00540579,2.02461787 1.00000265,2.037655 1,2.05125 L1,13 L9,13 L9,8 L15,8 L15,4 L7.98462,4 Z"/>
<rect width="6" height="1" x="10" y="13" fill="url(#palette.orange)"/>
<rect width="6" height="1" x="10" y="15" fill="url(#palette.orange)"/>
<rect width="6" height="1" x="10" y="11" fill="url(#palette.orange)"/>
<rect width="6" height="1" x="10" y="9" fill="url(#palette.orange)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="fileIconBackground"
fallback="Label.foreground" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#9AA7B0" stop-opacity=".8"/>
<stop offset="1" stop-color="#9AA7B0" stop-opacity=".8"/>
</linearGradient>
</defs>
<g fill="url(#fileIconBackground)" fill-rule="evenodd">
<path d="M7.9844,4 L6.6964,2.711 C6.3044,2.32 5.5324,2 4.9784,2 L1.0504,2 C1.0234,2 1.0004,2.023 1.0004,2.051 L1.0004,6 L2.0004,6 L2.0004,7 L3.0004,7.551 L3.0004,6 L4.0004,6 L4.0004,7 L5.0004,7.551 L5.0004,6 L6.0004,6 L6.0004,7 L7.0004,7.551 L7.0004,6 L8.0004,6 L8.0004,7 L9.0004,7.551 L9.0004,6 L10.0004,6 L10.0004,7 L11.0004,7.551 L11.0004,6 L12.0004,6 L12.0004,7 L13.0004,7.551 L13.0004,6 L14.0004,6 L14.0004,7 L15.0004,7.551 L15.0004,6 L15.0004,4 L7.9844,4 Z"/>
<polygon points="14 9 14 8.245 13 7.571 13 9 12 9 12 8.245 11 7.571 11 9 10 9 10 8.245 9 7.571 9 9 8 9 8 8.245 7 7.571 7 9 6 9 6 8.245 5 7.571 5 9 4 9 4 8.245 3 7.571 3 9 2 9 2 8.245 1 7.571 1 9 1 13 15 13 15 9"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

View File

@ -0,0 +1,27 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="fileIconBackground"
fallback="Label.foreground" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#9AA7B0" stop-opacity=".8"/>
<stop offset="1" stop-color="#9AA7B0" stop-opacity=".8"/>
</linearGradient>
<linearGradient id="palette.cyan"
fallback="%#40B6E0">
<stop offset="0" stop-color="#40B6E0" />
<stop offset="1" stop-color="#40B6E0" />
</linearGradient>
<linearGradient id="fileIconForeground"
fallback="Label.background" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#231F20" stop-opacity=".8"/>
<stop offset="1" stop-color="#231F20" stop-opacity=".8"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<polygon fill="url(#palette.cyan)" fill-opacity=".7" points="1 16 16 16 16 9 1 9"/>
<polygon fill="url(#fileIconBackground)" points="7 1 3 5 7 5"/>
<polygon fill="url(#fileIconBackground)" points="8 1 8 6 3 6 3 8 13 8 13 1"/>
<path fill="url(#fileIconForeground)" d="M1.39509277,3.58770752 C1.62440186,3.83789062 1.83782861,4 2.28682861,4 C2.81318359,4 3,3.58770752 3,3.29760742 L3,0 L4,0 L4,3.58770752 C4,4.31964111 3.32670898,5 2.45,5 C1.629,5 1.15,4.76264111 0.8,4.31964111 L1.39509277,3.58770752 Z" transform="translate(2 10)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,28 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="fileIconBackground"
fallback="Label.foreground" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#9AA7B0" stop-opacity=".8"/>
<stop offset="1" stop-color="#9AA7B0" stop-opacity=".8"/>
</linearGradient>
<linearGradient id="palette.cyan"
fallback="%#40B6E0">
<stop offset="0" stop-color="#40B6E0" />
<stop offset="1" stop-color="#40B6E0" />
</linearGradient>
<linearGradient id="fileIconForeground"
fallback="Label.background" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#231F20" stop-opacity=".8"/>
<stop offset="1" stop-color="#231F20" stop-opacity=".8"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<polygon fill="url(#palette.cyan)" fill-opacity=".7" points="1 16 16 16 16 9 1 9"/>
<polygon fill="url(#fileIconBackground)" points="7 1 3 5 7 5"/>
<polygon fill="url(#fileIconBackground)" points="8 1 8 6 3 6 3 8 13 8 13 1"/>
<path fill="url(#fileIconForeground)" d="M2,1 C1.292,1 1,1.54 1,2.5 C1,3.46 1.285,4 2,4 C2.715,4 3,3.446 3,2.5 C3,1.554 2.708,1 2,1 Z M2,-0.0003 C3.207,-0.0003 4,1.1177 4,2.4997 C4,3.8817 3.206,4.9997 2,4.9997 C0.794,4.9997 2.84217094e-14,3.881 2.84217094e-14,2.5 C2.84217094e-14,0.958803662 0.793,-0.0003 2,-0.0003 Z" transform="translate(3 10)"/>
<polygon fill="url(#fileIconForeground)" points="1.1 0 0 .443 .157 1.225 1 1 1 5 2 5 2 0" transform="translate(8 10)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 560 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="menuIconEnabled"
fallback="Label.foreground">
<stop offset="0" stop-color="#AFB1B3"/>
<stop offset="1" stop-color="#AFB1B3"/>
</linearGradient>
</defs>
<g fill="url(#menuIconEnabled)" fill-rule="evenodd">
<rect width="12" height="2" x="2" y="12"/>
<path d="M8.99999994,6 L12.6638093,6 L7.99690461,10.6838094 L3.32999992,6 L6.99999994,6 L6.99999994,1 L8.99999994,1 L8.99999994,6 Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="fileIconBackground"
fallback="Label.foreground" opacity="fileIconOpacity"
opacity-fallback="%100">
<stop offset="0" stop-color="#9AA7B0" stop-opacity=".8"/>
<stop offset="1" stop-color="#9AA7B0" stop-opacity=".8"/>
</linearGradient>
</defs>
<path fill="url(#fileIconBackground)" fill-rule="evenodd"
d="M6,10.4951 C4.896,10.4951 4.001,9.6001 4,8.4981 C3.999,7.3941 4.894,6.5001 5.997,6.5001 C7.102,6.5001 7.997,7.3941 7.998,8.4981 C7.999,9.6001 7.104,10.4951 6,10.4951 Z M7.984,4.0001 L6.696,2.7111 C6.305,2.3201 5.532,2.0001 4.979,2.0001 L1.051,2.0001 C1.023,2.0001 1,2.0231 1,2.0511 L1,13.0001 L15,13.0001 L15,4.0001 L7.984,4.0001 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 877 B

View File

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs id="colors">
<linearGradient id="menuIconEnabled"
fallback="Label.foreground">
<stop offset="0" stop-color="#AFB1B3"/>
<stop offset="1" stop-color="#AFB1B3"/>
</linearGradient>
</defs>
<g fill="url(#menuIconEnabled)" fill-rule="evenodd">
<rect width="12" height="2" x="2" y="12"/>
<path d="M8.99768582,6.32116052 L12.6609505,6.32190823 L7.99595397,11.0038095 L3.32904584,6.3200035 L6.99850209,6.32075247 L6.99850209,1.32095414 L8.99768582,1.32095414 L8.99768582,6.32116052 Z"
transform="matrix(1 0 0 -1 0 12.325)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 B

View File

@ -0,0 +1,103 @@
package the.bytecode.club.bytecodeviewer;
import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.properties.icons.*;
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
import the.bytecode.club.bytecodeviewer.resources.IconResources;
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJRadioButtonMenuItem;
import javax.swing.*;
import java.awt.*;
public class IconDemo
{
public static void main(String[] args)
{
SwingUtilities.invokeLater(() -> {
switchToLaf(LAFTheme.SYSTEM);
JFrame frame = new JFrame("Icon Demo");
JMenuBar menuBar = new JMenuBar();
frame.setJMenuBar(menuBar);
JMenu menu = menuBar.add(new JMenu("Theme"));
ButtonGroup lafGroup = new ButtonGroup();
for (LAFTheme theme : LAFTheme.values())
{
JRadioButtonMenuItem item = new TranslatedJRadioButtonMenuItem(theme.getReadableName(), theme.getTranslation());
if (LAFTheme.SYSTEM.equals(theme))
item.setSelected(true);
lafGroup.add(item);
item.addActionListener(e -> switchToLaf(theme));
menu.add(item);
}
IconEntry[] iconEntries = new IconEntry[] {
new IconEntry("Next", IconResources.nextIcon),
new IconEntry("Previous", IconResources.prevIcon),
new IconEntry("Busy", IconResources.busyIcon),
new IconEntry(".bat", IconResources.batIcon),
new IconEntry(".sh", IconResources.shIcon),
new IconEntry(".cs", IconResources.csharpIcon),
new IconEntry(".cpp", IconResources.cplusplusIcon),
new IconEntry(".Config", IconResources.configIcon),
new IconEntry(".jar", IconResources.jarIcon),
new IconEntry(".zip", IconResources.zipIcon),
new IconEntry("Package", IconResources.packagesIcon),
new IconEntry("Folder", IconResources.folderIcon),
new IconEntry("Android", IconResources.androidIcon),
new IconEntry("Unknown File", IconResources.unknownFileIcon),
new IconEntry("Text", IconResources.textIcon),
new IconEntry(".class", IconResources.classIcon),
new IconEntry("Image", IconResources.imageIcon),
new IconEntry("Decoded", IconResources.decodedIcon),
new IconEntry(".java", IconResources.javaIcon),
};
JList<IconEntry> iconList = new JList<>(iconEntries);
iconList.setCellRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus)
{
super.getListCellRendererComponent(list, ((IconEntry) value).name, index, isSelected, cellHasFocus);
setIcon(((IconEntry) value).icon);
return this;
}
});
JComponent content = new JScrollPane(iconList);
content.setPreferredSize(new Dimension(200, 400));
frame.setContentPane(content);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
}
private static void switchToLaf(LAFTheme theme)
{
try
{
theme.setLAF();
LafManager.updateLaf();
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
private static class IconEntry
{
private static final int DISPLAY_SIZE = 50;
private final String name;
private final Icon icon;
private IconEntry(String name, Icon icon)
{
this.name = name;
this.icon = IconLoader.createDerivedIcon(icon, DISPLAY_SIZE, DISPLAY_SIZE);
}
}
}