1 26 27 import java.awt.BorderLayout ; 28 import java.io.File ; 29 import java.io.IOException ; 30 import java.net.MalformedURLException ; 31 import java.util.jar.JarFile ; 32 33 import javax.swing.JFrame ; 34 import javax.swing.JSplitPane ; 35 36 import org.objectweb.util.browser.core.api.StatusBar; 37 import org.objectweb.util.browser.core.api.ViewPanel; 38 import org.objectweb.util.browser.core.common.DefaultStatusBar; 39 import org.objectweb.util.browser.core.common.DefaultTreePanel; 40 import org.objectweb.util.browser.core.common.DefaultViewPanel; 41 import org.objectweb.util.browser.core.common.DynamicTree; 42 import org.objectweb.util.browser.plugin.java.reflect.JarFileStructure; 43 44 53 public class ReflectorConsole { 54 55 public ReflectorConsole(String configFile){ 56 JFrame frame = new JFrame ("Browser GUI"); 58 59 ViewPanel viewPanel = new DefaultViewPanel(); 61 62 StatusBar statusBar = new DefaultStatusBar(); 64 65 DynamicTree tree = new DynamicTree(); 67 68 tree.setNewBrowserProperty(new String []{configFile}); 70 tree.setTargetPanel(viewPanel); 71 tree.setStatusBar(statusBar); 72 73 try { 75 File f = new File ("build/lib/reflect-plugin.jar"); 76 tree.addEntry(f.getName(), new JarFileStructure(new JarFile (f),f.toURL()),8); 77 } catch (MalformedURLException e) { 78 e.printStackTrace(); 79 } catch (IOException e) { 80 e.printStackTrace(); 81 } 82 83 frame.getContentPane().setLayout(new BorderLayout ()); 85 frame.getContentPane().add( 86 new JSplitPane ( 87 JSplitPane.HORIZONTAL_SPLIT, 88 true, 89 new DefaultTreePanel((DynamicTree)tree), 90 ((DefaultViewPanel)viewPanel)), 91 BorderLayout.CENTER); 92 frame.getContentPane().add((DefaultStatusBar)statusBar, BorderLayout.SOUTH); 93 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 94 frame.pack(); 95 frame.setVisible(true); 96 } 97 98 public static void main(String [] args){ 99 if(args.length != 0) 100 new ReflectorConsole(args[0]); 101 else 102 System.err.println("Java Archive expected!"); 103 } 104 105 } 106 | Popular Tags |