|
|
@ -38,20 +38,13 @@ public class MainWindow |
|
|
|
implements ActionListener, Runnable, TreeSelectionListener { |
|
|
|
implements ActionListener, Runnable, TreeSelectionListener { |
|
|
|
JTree classTree; |
|
|
|
JTree classTree; |
|
|
|
PackagesTreeModel classModel; |
|
|
|
PackagesTreeModel classModel; |
|
|
|
TextArea sourcecodeArea, errorArea; |
|
|
|
JTextArea sourcecodeArea, errorArea; |
|
|
|
String classpath, lastClassName; |
|
|
|
String classpath, lastClassName; |
|
|
|
Thread decompileThread; |
|
|
|
Thread decompileThread; |
|
|
|
|
|
|
|
|
|
|
|
public MainWindow(Container frame) { |
|
|
|
public MainWindow(Container contentPane) { |
|
|
|
frame.setLayout(new GridBagLayout()); |
|
|
|
Font monospaced = new Font("monospaced", Font.PLAIN, 12); |
|
|
|
GridBagConstraints c = new GridBagConstraints(); |
|
|
|
|
|
|
|
c.gridx = 0; |
|
|
|
|
|
|
|
c.gridy = 0; |
|
|
|
|
|
|
|
c.gridwidth = 1; |
|
|
|
|
|
|
|
c.gridheight = 2; |
|
|
|
|
|
|
|
c.weightx = 0.5; |
|
|
|
|
|
|
|
c.weighty = 1.0; |
|
|
|
|
|
|
|
c.fill = c.BOTH; |
|
|
|
|
|
|
|
classModel = new PackagesTreeModel(); |
|
|
|
classModel = new PackagesTreeModel(); |
|
|
|
classTree = new JTree(classModel); |
|
|
|
classTree = new JTree(classModel); |
|
|
|
classTree.setRootVisible(false); |
|
|
|
classTree.setRootVisible(false); |
|
|
@ -59,27 +52,23 @@ public class MainWindow |
|
|
|
selModel.setSelectionMode(selModel.SINGLE_TREE_SELECTION); |
|
|
|
selModel.setSelectionMode(selModel.SINGLE_TREE_SELECTION); |
|
|
|
classTree.setSelectionModel(selModel); |
|
|
|
classTree.setSelectionModel(selModel); |
|
|
|
classTree.addTreeSelectionListener(this); |
|
|
|
classTree.addTreeSelectionListener(this); |
|
|
|
JScrollPane sp = new JScrollPane(); |
|
|
|
JScrollPane spClassTree = new JScrollPane(classTree); |
|
|
|
sp.getViewport().add(classTree); |
|
|
|
sourcecodeArea = new JTextArea(20, 80); |
|
|
|
frame.add(sp, c); |
|
|
|
sourcecodeArea.setFont(monospaced); |
|
|
|
c.gridx = 1; |
|
|
|
JScrollPane spText = new JScrollPane(sourcecodeArea); |
|
|
|
c.gridy = 0; |
|
|
|
errorArea = new JTextArea(3, 80); |
|
|
|
c.gridwidth = 1; |
|
|
|
errorArea.setFont(monospaced); |
|
|
|
c.gridheight = 1; |
|
|
|
JScrollPane spError = new JScrollPane(errorArea); |
|
|
|
c.weightx = 1.0; |
|
|
|
|
|
|
|
c.weighty = 1.0; |
|
|
|
JSplitPane rightPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, |
|
|
|
c.fill = c.BOTH; |
|
|
|
spText, spError); |
|
|
|
sourcecodeArea = new TextArea(20, 80); |
|
|
|
JSplitPane allPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, |
|
|
|
frame.add(sourcecodeArea, c); |
|
|
|
spClassTree, rightPane); |
|
|
|
c.gridx = 1; |
|
|
|
contentPane.add(allPane); |
|
|
|
c.gridy = 1; |
|
|
|
rightPane.setDividerLocation(300); |
|
|
|
c.gridwidth = 1; |
|
|
|
rightPane.setDividerSize(4); |
|
|
|
c.gridheight = 1; |
|
|
|
allPane.setDividerLocation(200); |
|
|
|
c.weightx = 1.0; |
|
|
|
allPane.setDividerSize(4); |
|
|
|
c.weighty = 0.0; |
|
|
|
|
|
|
|
c.fill = c.BOTH; |
|
|
|
|
|
|
|
errorArea = new TextArea(3, 80); |
|
|
|
|
|
|
|
frame.add(errorArea, c); |
|
|
|
|
|
|
|
Decompiler.err = new PrintStream(new AreaOutputStream(errorArea)); |
|
|
|
Decompiler.err = new PrintStream(new AreaOutputStream(errorArea)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -136,9 +125,9 @@ public class MainWindow |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class AreaOutputStream extends OutputStream { |
|
|
|
public class AreaOutputStream extends OutputStream { |
|
|
|
private TextArea area; |
|
|
|
private JTextArea area; |
|
|
|
|
|
|
|
|
|
|
|
public AreaOutputStream(TextArea a) { |
|
|
|
public AreaOutputStream(JTextArea a) { |
|
|
|
area = a; |
|
|
|
area = a; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|