diff --git a/src/com/jpexs/decompiler/flash/gui/MyTree.java b/src/com/jpexs/decompiler/flash/gui/MyTree.java
deleted file mode 100644
index d895f35ed..000000000
--- a/src/com/jpexs/decompiler/flash/gui/MyTree.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2010-2014 JPEXS
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.jpexs.decompiler.flash.gui;
-
-import java.awt.Color;
-import javax.swing.JTree;
-import javax.swing.tree.TreeModel;
-
-/**
- *
- * @author JPEXS
- */
-public class MyTree extends JTree {
-
- public MyTree() {
- setUI(new MyTreeUI());
- setBackground(Color.white);
- }
-
- public MyTree(TreeModel newModel) {
- super(newModel);
- setUI(new MyTreeUI());
- setBackground(Color.white);
- }
- private boolean overrideIsEnabled = false;
-
- public void setOverrideIsEnable(boolean b) {
- overrideIsEnabled = true;
- }
-
- public boolean isOverrideIsEnable(boolean b) {
- return overrideIsEnabled;
- }
-
- @Override
- public boolean isEnabled() {
- if (overrideIsEnabled) {
- return false;
- }
- return super.isEnabled();
- }
- /*
- @Override
- public void paint(Graphics g) {
- g.setColor(Color.white);
- g.fillRect(0, 0, getWidth(), getHeight());
- super.paint(g);
- }*/
-}
diff --git a/src/com/jpexs/decompiler/flash/gui/MyTreeUI.java b/src/com/jpexs/decompiler/flash/gui/MyTreeUI.java
deleted file mode 100644
index 731eb07fe..000000000
--- a/src/com/jpexs/decompiler/flash/gui/MyTreeUI.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2010-2014 JPEXS
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.jpexs.decompiler.flash.gui;
-
-import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.Rectangle;
-import java.lang.reflect.Field;
-import javax.swing.tree.TreePath;
-import org.pushingpixels.substance.internal.ui.SubstanceTreeUI;
-
-/**
- *
- * @author JPEXS
- */
-class MyTreeUI extends SubstanceTreeUI {
-
- @Override
- protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
- Insets insets, Rectangle bounds, TreePath path, int row,
- boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) {
- System.out.println("");
- if (this.tree instanceof MyTree) {
- Field f = null;
- Boolean v = false;
- try {
- f = SubstanceTreeUI.class.getDeclaredField("inside");
- f.setAccessible(true);
- v = (Boolean) f.get(this);
- f.set(this, Boolean.TRUE);
- ((MyTree) this.tree).setOverrideIsEnable(true);
- } catch (Throwable t) {
- //want to default back to substanceUI if this fails.
- }
-
- super.paintHorizontalPartOfLeg(g, bounds, insets, bounds, path, row, isLeaf, isLeaf, isLeaf);
- try {
- f.set(this, v);
- ((MyTree) this.tree).setOverrideIsEnable(true);
- } catch (Throwable t) {
- //see above
- }
- }
- }
-//repeat for Vertical
-}
diff --git a/src/com/jpexs/decompiler/flash/gui/View.java b/src/com/jpexs/decompiler/flash/gui/View.java
index d78bc0e7b..acca77440 100644
--- a/src/com/jpexs/decompiler/flash/gui/View.java
+++ b/src/com/jpexs/decompiler/flash/gui/View.java
@@ -69,6 +69,7 @@ import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.FontUIResource;
+import javax.swing.plaf.TreeUI;
import javax.swing.plaf.basic.BasicColorChooserUI;
import javax.swing.text.JTextComponent;
import javax.swing.tree.TreeModel;
@@ -514,7 +515,14 @@ public class View {
tree.expandPath(tp);
}
- public static void expandTreeNodesRecursive(JTree tree, TreePath parent, boolean expand) {
+ public static void expandTreeNodes(JTree tree, TreePath parent, boolean expand) {
+ TreeUI ui = tree.getUI();
+ tree.setUI(null);
+ expandTreeNodesRecursive(tree, parent, expand);
+ tree.setUI(ui);
+ }
+
+ private static void expandTreeNodesRecursive(JTree tree, TreePath parent, boolean expand) {
TreeModel model = tree.getModel();
Object node = parent.getLastPathComponent();
diff --git a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java
index a364f501c..116abe314 100644
--- a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java
+++ b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java
@@ -211,7 +211,7 @@ public class DumpTree extends JTree implements ActionListener {
if (path == null) {
return;
}
- View.expandTreeNodesRecursive(this, path, true);
+ View.expandTreeNodes(this, path, true);
}
break;
case ACTION_SAVE_TO_FILE: {
diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java
index bf61b3214..e2e23803c 100644
--- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java
+++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java
@@ -113,15 +113,14 @@ import com.jpexs.decompiler.flash.treeitems.TreeItem;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
-import java.awt.Graphics;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.Icon;
-import javax.swing.JComponent;
import javax.swing.JTree;
+import javax.swing.plaf.TreeUI;
import javax.swing.plaf.basic.BasicLabelUI;
import javax.swing.plaf.basic.BasicTreeUI;
import javax.swing.tree.DefaultTreeCellRenderer;
@@ -216,13 +215,15 @@ public class TagTree extends JTree {
setCellRenderer(new TagTreeCellRenderer());
setRootVisible(false);
setBackground(Color.white);
- setUI(new BasicTreeUI() {
- @Override
- public void paint(Graphics g, JComponent c) {
+ setRowHeight(16);
+ setLargeModel(true);
+
+ TreeUI treeUI = new BasicTreeUI() {
+ {
setHashColor(Color.gray);
- super.paint(g, c);
}
- });
+ };
+ setUI(treeUI);
}
public void createContextMenu() {
diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java
index 6b2f8d821..403074c66 100644
--- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java
+++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java
@@ -364,7 +364,7 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
if (path == null) {
return;
}
- View.expandTreeNodesRecursive(tagTree, path, true);
+ View.expandTreeNodes(tagTree, path, true);
}
break;
case ACTION_REMOVE_ITEM:
diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java
index d8c565ce4..bb69f4237 100644
--- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java
+++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeModel.java
@@ -461,7 +461,7 @@ public class TagTreeModel implements TreeModel {
} else if (parentNode instanceof Frame) {
return ((Frame) parentNode).innerTags.indexOf(childNode);
} else if (parentNode instanceof DefineSpriteTag) {
- return ((Frame) parentNode).frame;
+ return ((Frame) childNode).frame;
} else if (parentNode instanceof DefineBinaryDataTag) {
return 0; // binary data tag can have only 1 child
} else if (parentNode instanceof AS2Package) {