01: package net.xoetrope.swing;
02:
03: import javax.swing.JPanel;
04: import javax.swing.JComponent;
05: import java.awt.Color;
06: import java.awt.BorderLayout;
07: import java.awt.CardLayout;
08: import java.awt.FlowLayout;
09: import java.awt.Label;
10: import javax.swing.JTabbedPane;
11: import java.awt.Component;
12: import net.xoetrope.xui.XPage;
13: import java.util.Hashtable;
14: import net.xoetrope.builder.XuiBuilder;
15:
16: /**
17: * A tab panel.
18: * <p> Copyright (c) Xoetrope Ltd., 2002-2004</p>
19: * <p> $Revision: 1.2 $</p>
20: * <p> License: see License.txt</p>
21: */
22: public class XTabPanel extends JTabbedPane {
23: public XTabPanel() {
24: }
25:
26: /**
27: * Add a new tab.
28: * The add method could not be overloaded so this method adds does the
29: * equivalent.
30: * @param name the name/caption of the tab component
31: * @param panel the content
32: */
33: public Component add(Component comp) {
34: String title = null;
35: try {
36: Hashtable attribs = XuiBuilder.getCurrentAttributes();
37: title = (String) attribs.get("title");
38: } catch (Exception ex) {
39: }
40: addTab(title, comp);
41: return comp;
42: }
43:
44: /**
45: * Add a new tab.
46: * The add method could not be overloaded so this method adds does the
47: * equivalent.
48: * @param name the name/caption of the tab component
49: * @param panel the content
50: */
51: public void addTab(String name, JComponent panel) {
52: super.add(name, panel);
53: }
54: }
|