KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > MapConsole


1 /*====================================================================
2
3 Objectweb Browser Framework
4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Philippe Merle, Jerome Moroy.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 import java.awt.BorderLayout JavaDoc;
28 import javax.swing.JFrame JavaDoc;
29
30 import org.objectweb.util.browser.core.api.StatusBar;
31 import org.objectweb.util.browser.core.api.ViewPanel;
32 import org.objectweb.util.browser.core.common.DefaultStatusBar;
33 import org.objectweb.util.browser.core.common.DefaultTreePanel;
34 import org.objectweb.util.browser.core.common.DefaultViewPanel;
35 import org.objectweb.util.browser.core.common.DynamicTree;
36
37 /**
38  * This class builds a example console built on top of the Browser Framework.
39  * This console allows us to manage <code>java.util.Map</code> Object.
40  *
41  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>,
42  * <a HREF="mailto:Jerome.Moroy@lifl.fr">Jérôme Moroy</a>
43  *
44  * @version 0.1
45  */

46 public class MapConsole
47 {
48
49     public static void main(String JavaDoc[] args)
50     {
51         // Creates the main frame.
52
JFrame JavaDoc frame = new JFrame JavaDoc("Browser GUI");
53         
54         // Creates the view panel.
55
ViewPanel viewPanel = new DefaultViewPanel();
56         
57         // Creates the status bar.
58
StatusBar statusBar = new DefaultStatusBar();
59         
60         // Creates the tree.
61
DynamicTree tree = new DynamicTree();
62         
63         // Populates the tree.
64
tree.addEntry("Object 1", new Object JavaDoc());
65         tree.addEntry("Object 2", new Object JavaDoc());
66         tree.addEntry("Map", new java.util.HashMap JavaDoc());
67         
68         // Configures the tree.
69
tree.setNewBrowserProperty(new String JavaDoc[]{args[0]});
70         tree.setTargetPanel(viewPanel);
71         tree.setStatusBar(statusBar);
72         
73         // Configures the main frame.
74
frame.getContentPane().setLayout(new BorderLayout JavaDoc());
75         frame.getContentPane().add(new DefaultTreePanel((DynamicTree)tree),
76             BorderLayout.CENTER);
77         frame.getContentPane().add(((DefaultViewPanel)viewPanel), BorderLayout.EAST);
78         frame.getContentPane().add((DefaultStatusBar)statusBar, BorderLayout.SOUTH);
79         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
80         frame.pack();
81         frame.setVisible(true);
82     }
83
84 }
85
Popular Tags