Replace usage of IconImage with Icon
This allows us to use icons other than ImageIcons.
This commit is contained in:
parent
47e069c44f
commit
40e26c27f8
3 changed files with 29 additions and 30 deletions
|
@ -5,8 +5,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.*;
|
||||||
import javax.swing.JTree;
|
|
||||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||||
import javax.swing.tree.TreeNode;
|
import javax.swing.tree.TreeNode;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
@ -21,7 +20,7 @@ import the.bytecode.club.bytecodeviewer.resources.ResourceType;
|
||||||
public class ResourceListIconRenderer extends DefaultTreeCellRenderer
|
public class ResourceListIconRenderer extends DefaultTreeCellRenderer
|
||||||
{
|
{
|
||||||
//TODO the icon cache needs to be cleared on treenode removal
|
//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
|
//called every time there is a pane update
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,7 +133,7 @@ public class ResourceListIconRenderer extends DefaultTreeCellRenderer
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cacheNodeIcon(ResourceTreeNode node, ImageIcon icon)
|
public void cacheNodeIcon(ResourceTreeNode node, Icon icon)
|
||||||
{
|
{
|
||||||
iconCache.put(node, icon);
|
iconCache.put(node, icon);
|
||||||
setIcon(icon);
|
setIcon(icon);
|
||||||
|
|
|
@ -49,28 +49,28 @@ public class IconResources
|
||||||
static protected final int HALF_SIZE = 4;
|
static protected final int HALF_SIZE = 4;
|
||||||
static protected final int SIZE = 9;
|
static protected final int SIZE = 9;
|
||||||
|
|
||||||
public static List<BufferedImage> iconList;
|
public static final List<BufferedImage> iconList;
|
||||||
public static BufferedImage icon;
|
public static final BufferedImage icon;
|
||||||
public static ImageIcon nextIcon;
|
public static final Icon nextIcon;
|
||||||
public static ImageIcon prevIcon;
|
public static final Icon prevIcon;
|
||||||
public static ImageIcon busyIcon;
|
public static final Icon busyIcon;
|
||||||
public static ImageIcon busyB64Icon;
|
public static final Icon busyB64Icon;
|
||||||
public static ImageIcon batIcon;
|
public static final Icon batIcon;
|
||||||
public static ImageIcon shIcon;
|
public static final Icon shIcon;
|
||||||
public static ImageIcon csharpIcon;
|
public static final Icon csharpIcon;
|
||||||
public static ImageIcon cplusplusIcon;
|
public static final Icon cplusplusIcon;
|
||||||
public static ImageIcon configIcon;
|
public static final Icon configIcon;
|
||||||
public static ImageIcon jarIcon;
|
public static final Icon jarIcon;
|
||||||
public static ImageIcon zipIcon;
|
public static final Icon zipIcon;
|
||||||
public static ImageIcon packagesIcon;
|
public static final Icon packagesIcon;
|
||||||
public static ImageIcon folderIcon;
|
public static final Icon folderIcon;
|
||||||
public static ImageIcon androidIcon;
|
public static final Icon androidIcon;
|
||||||
public static ImageIcon unknownFileIcon;
|
public static final Icon unknownFileIcon;
|
||||||
public static ImageIcon textIcon;
|
public static final Icon textIcon;
|
||||||
public static ImageIcon classIcon;
|
public static final Icon classIcon;
|
||||||
public static ImageIcon imageIcon;
|
public static final Icon imageIcon;
|
||||||
public static ImageIcon decodedIcon;
|
public static final Icon decodedIcon;
|
||||||
public static ImageIcon javaIcon;
|
public static final Icon javaIcon;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@ package the.bytecode.club.bytecodeviewer.resources;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.*;
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
|
* 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> imageExtensionMap = new HashMap<>();
|
||||||
public static final Map<String, ResourceType> supportedBCVExtensionMap = 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 String[] extensions;
|
||||||
//private final byte[][] headerMagicNumber;
|
//private final byte[][] headerMagicNumber;
|
||||||
|
|
||||||
|
@ -79,13 +79,13 @@ public enum ResourceType
|
||||||
supportedBCVExtensionMap.put(extension, ANDROID_ARCHIVE);
|
supportedBCVExtensionMap.put(extension, ANDROID_ARCHIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceType(ImageIcon icon, String... extensions)
|
ResourceType(Icon icon, String... extensions)
|
||||||
{
|
{
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
this.extensions = extensions;
|
this.extensions = extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageIcon getIcon()
|
public Icon getIcon()
|
||||||
{
|
{
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue