1 26 27 import java.awt.BorderLayout ; 28 import java.util.Vector ; 29 30 import javax.swing.JFrame ; 31 import javax.swing.JSplitPane ; 32 33 import org.objectweb.util.browser.core.api.ContextContainer; 34 import org.objectweb.util.browser.core.api.StatusBar; 35 import org.objectweb.util.browser.core.api.ViewPanel; 36 import org.objectweb.util.browser.core.common.DefaultStatusBar; 37 import org.objectweb.util.browser.core.common.DefaultTreePanel; 38 import org.objectweb.util.browser.core.common.DefaultViewPanel; 39 import org.objectweb.util.browser.core.common.DynamicTree; 40 import org.objectweb.util.browser.core.naming.DefaultContextContainer; 41 42 51 public class BasicConsole { 52 53 public BasicConsole(String configFile){ 54 JFrame frame = new JFrame ("Browser GUI"); 56 57 ViewPanel viewPanel = new DefaultViewPanel(); 59 60 StatusBar statusBar = new DefaultStatusBar(); 62 63 DynamicTree tree = new DynamicTree(); 65 66 tree.addEntry("Java Properties", System.getProperties()); 68 ContextContainer contextContainer = new DefaultContextContainer(); 69 contextContainer.addEntry("Object 1", new Object ()); 70 contextContainer.addEntry("Object 2", new Object ()); 71 tree.addEntry("Context", contextContainer); 72 tree.addEntry("Vector", new Vector ()); 73 74 tree.setNewBrowserProperty(new String []{configFile}); 76 tree.setTargetPanel(viewPanel); 77 tree.setStatusBar(statusBar); 78 79 frame.getContentPane().setLayout(new BorderLayout ()); 81 frame.getContentPane().add( 82 new JSplitPane ( 83 JSplitPane.HORIZONTAL_SPLIT, 84 true, 85 new DefaultTreePanel((DynamicTree)tree), 86 ((DefaultViewPanel)viewPanel)), 87 BorderLayout.CENTER); 88 frame.getContentPane().add((DefaultStatusBar)statusBar, BorderLayout.SOUTH); 89 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 90 frame.pack(); 91 frame.setVisible(true); 92 } 93 94 public static void main(String [] args){ 95 if(args.length != 0) 96 new BasicConsole(args[0]); 97 } 98 99 } 100 | Popular Tags |