1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.gui.panels;
11
12 import java.awt.Component;
13 import java.util.HashMap;
14 import java.util.Map;
15
16 import javax.swing.JTabbedPane;
17
18 /***
19 * The TabbedPane <br>
20 * (c) copyright 2002-2005 <a href="http://www.simulation.tudelft.nl">Delft
21 * University of Technology </a>, the Netherlands. <br>
22 * See for project information <a
23 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
24 * License of use: <a href="http://www.gnu.org/copyleft/lesser.html">Lesser
25 * General Public License (LGPL) </a>, no warranty.
26 *
27 * @version $Revision: 1.4 $ $Date: 2005/01/13 16:28:54 $
28 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja">Peter Jacobs </a>
29 */
30 public class TabbedPane extends JTabbedPane
31 {
32 /*** the content of the tabbedPane */
33 private Map content = new HashMap();
34
35 /***
36 * constructs a new TabbedPane
37 */
38 public TabbedPane()
39 {
40 super();
41 }
42
43 /***
44 * constructs a new TabbedPane
45 *
46 * @param tabPlacement the placement
47 */
48 public TabbedPane(final int tabPlacement)
49 {
50 super(tabPlacement);
51 }
52
53 /***
54 * constructs a new TabbedPane
55 *
56 * @param tabPlacement the placement
57 * @param tabLayoutPolicy the policy
58 */
59 public TabbedPane(final int tabPlacement, final int tabLayoutPolicy)
60 {
61 super(tabPlacement, tabLayoutPolicy);
62 }
63
64 /***
65 * adds a component to the pane
66 *
67 * @param title the title of the component
68 * @param index the index position at which the component will be placed.
69 * @param component the component
70 * @return the component
71 */
72 public Component add(final String title, final int index,
73 final Component component)
74 {
75 this.content.put(title, component);
76 component.setName(title);
77 return super.add(component, index);
78 }
79
80 /***
81 * removes the component from the tabbedPane
82 *
83 * @param title the title of the tab
84 */
85 public void remove(final String title)
86 {
87 Component component = (Component) this.content.get(title);
88 if (component != null)
89 {
90 this.remove(component);
91 }
92 }
93 }