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 2003 <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/gpl.html">General Public
25 * License (GPL) </a>, no warranty <br>
26 *
27 * @version 1.0 18.10.2003 <br>
28 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
29 * Jacobs </a>
30 */
31 public class TabbedPane extends JTabbedPane
32 {
33 /*** the content of the tabbedPane */
34 private Map content = new HashMap();
35
36 /***
37 * constructs a new TabbedPane
38 */
39 public TabbedPane()
40 {
41 super();
42 }
43
44 /***
45 * constructs a new TabbedPane
46 *
47 * @param tabPlacement the placement
48 */
49 public TabbedPane(final int tabPlacement)
50 {
51 super(tabPlacement);
52 }
53
54 /***
55 * constructs a new TabbedPane
56 *
57 * @param tabPlacement the placement
58 * @param tabLayoutPolicy the policy
59 */
60 public TabbedPane(final int tabPlacement, final int tabLayoutPolicy)
61 {
62 super(tabPlacement, tabLayoutPolicy);
63 }
64
65 /***
66 * adds a component to the pane
67 *
68 * @param title the title of the component
69 * @param index the index position at which the component will be placed.
70 * @param component the component
71 * @return the component
72 */
73 public Component add(final String title, final int index,
74 final Component component)
75 {
76 this.content.put(title, component);
77 component.setName(title);
78 return super.add(component, index);
79 }
80
81 /***
82 * removes the component from the tabbedPane
83 *
84 * @param title the title of the tab
85 */
86 public void remove(final String title)
87 {
88 Component component = (Component) this.content.get(title);
89 if (component != null)
90 {
91 this.remove(component);
92 }
93 }
94 }