56 |
import javax.swing.plaf.UIResource; |
import javax.swing.plaf.UIResource; |
57 |
|
|
58 |
/** |
/** |
59 |
* This is a container for components. One component is displayed at a time. |
* This is a container for components where only one component is displayed at |
60 |
* Users can switch between components by clicking on tabs. |
* a given time and the displayed component can be switched by clicking on |
61 |
|
* tabs. |
62 |
* |
* |
63 |
* <p> |
* <p> |
64 |
* Tabs can be oriented in several ways. They can be above, below, left and |
* Tabs can be oriented in several ways. They can be above, below, left and |
73 |
SwingConstants |
SwingConstants |
74 |
{ |
{ |
75 |
/** |
/** |
76 |
* DOCUMENT ME! |
* Accessibility support for <code>JTabbedPane</code>. |
77 |
*/ |
*/ |
78 |
protected class AccessibleJTabbedPane extends JComponent.AccessibleJComponent |
protected class AccessibleJTabbedPane extends JComponent.AccessibleJComponent |
79 |
implements AccessibleSelection, ChangeListener |
implements AccessibleSelection, ChangeListener |
80 |
{ |
{ |
81 |
/** DOCUMENT ME! */ |
/** |
82 |
|
* The serialization UID. |
83 |
|
*/ |
84 |
private static final long serialVersionUID = 7610530885966830483L; |
private static final long serialVersionUID = 7610530885966830483L; |
85 |
|
|
86 |
/** |
/** |
92 |
} |
} |
93 |
|
|
94 |
/** |
/** |
95 |
* DOCUMENT ME! |
* Receives notification when the selection state of the |
96 |
|
* <code>JTabbedPane</code> changes. |
97 |
* |
* |
98 |
* @param e DOCUMENT ME! |
* @param e the change event describing the change |
99 |
*/ |
*/ |
100 |
public void stateChanged(ChangeEvent e) |
public void stateChanged(ChangeEvent e) |
101 |
{ |
{ |
102 |
} |
} |
103 |
|
|
104 |
/** |
/** |
105 |
* DOCUMENT ME! |
* Returns the accessible role of the <code>JTabbedPane</code>, which is |
106 |
|
* {@link AccessibleRole#PAGE_TAB_LIST}. |
107 |
* |
* |
108 |
* @return DOCUMENT ME! |
* @return the accessible role of the <code>JTabbedPane</code> |
109 |
*/ |
*/ |
110 |
public AccessibleRole getAccessibleRole() |
public AccessibleRole getAccessibleRole() |
111 |
{ |
{ |
113 |
} |
} |
114 |
|
|
115 |
/** |
/** |
116 |
* DOCUMENT ME! |
* Returns the number of accessible child components of the |
117 |
|
* <code>JTabbedPane</code>. |
118 |
* |
* |
119 |
* @return DOCUMENT ME! |
* @return the number of accessible child components of the |
120 |
|
* <code>JTabbedPane</code> |
121 |
*/ |
*/ |
122 |
public int getAccessibleChildrenCount() |
public int getAccessibleChildrenCount() |
123 |
{ |
{ |
125 |
} |
} |
126 |
|
|
127 |
/** |
/** |
128 |
* DOCUMENT ME! |
* Returns the accessible child component at the specified index. |
129 |
* |
* |
130 |
* @param i DOCUMENT ME! |
* @param i the index of the child component to fetch |
131 |
* |
* |
132 |
* @return DOCUMENT ME! |
* @return the accessible child component at the specified index |
133 |
*/ |
*/ |
134 |
public Accessible getAccessibleChild(int i) |
public Accessible getAccessibleChild(int i) |
135 |
{ |
{ |
137 |
} |
} |
138 |
|
|
139 |
/** |
/** |
140 |
* DOCUMENT ME! |
* Returns the current selection state of the <code>JTabbedPane</code> |
141 |
|
* as AccessibleSelection object. |
142 |
* |
* |
143 |
* @return DOCUMENT ME! |
* @return the current selection state of the <code>JTabbedPane</code> |
144 |
*/ |
*/ |
145 |
public AccessibleSelection getAccessibleSelection() |
public AccessibleSelection getAccessibleSelection() |
146 |
{ |
{ |
148 |
} |
} |
149 |
|
|
150 |
/** |
/** |
151 |
* DOCUMENT ME! |
* Returns the accessible child component at the specified coordinates. |
152 |
* |
* If there is no child component at this location, then return the |
153 |
* @param p DOCUMENT ME! |
* currently selected tab. |
154 |
* |
* |
155 |
* @return DOCUMENT ME! |
* @param p the coordinates at which to look up the child component |
156 |
|
* |
157 |
|
* @return the accessible child component at the specified coordinates or |
158 |
|
* the currently selected tab if there is no child component at |
159 |
|
* this location |
160 |
*/ |
*/ |
161 |
public Accessible getAccessibleAt(Point p) |
public Accessible getAccessibleAt(Point p) |
162 |
{ |
{ |
164 |
} |
} |
165 |
|
|
166 |
/** |
/** |
167 |
* DOCUMENT ME! |
* The number of selected child components of the |
168 |
|
* <code>JTabbedPane</code>. This will be <code>0</code> if the |
169 |
|
* <code>JTabbedPane</code> has no children, or <code>1</code> otherwise, |
170 |
|
* since there is always exactly one tab selected. |
171 |
* |
* |
172 |
* @return DOCUMENT ME! |
* @return number of selected child components of the |
173 |
|
* <code>JTabbedPane</code> |
174 |
*/ |
*/ |
175 |
public int getAccessibleSelectionCount() |
public int getAccessibleSelectionCount() |
176 |
{ |
{ |
879 |
* This method inserts tabs into JTabbedPane. This includes adding the |
* This method inserts tabs into JTabbedPane. This includes adding the |
880 |
* component to the JTabbedPane and hiding it. |
* component to the JTabbedPane and hiding it. |
881 |
* |
* |
882 |
* @param title The title of the tab. |
* @param title the title of the tab; may be <code>null</code> |
883 |
* @param icon The tab's icon. |
* @param icon the tab's icon; may be <code>null</code> |
884 |
* @param component The component associated with the tab. |
* @param component the component associated with the tab |
885 |
* @param tip The tooltip for the tab. |
* @param tip the tooltip for the tab |
886 |
* @param index The index to insert the tab at. |
* @param index the index to insert the tab at |
887 |
*/ |
*/ |
888 |
public void insertTab(String title, Icon icon, Component component, |
public void insertTab(String title, Icon icon, Component component, |
889 |
String tip, int index) |
String tip, int index) |
890 |
{ |
{ |
891 |
|
if (title == null) |
892 |
|
title = ""; |
893 |
Page p = new Page(title, icon, component, tip); |
Page p = new Page(title, icon, component, tip); |
894 |
tabs.insertElementAt(p, index); |
tabs.insertElementAt(p, index); |
895 |
|
|
911 |
/** |
/** |
912 |
* This method adds a tab to the JTabbedPane. |
* This method adds a tab to the JTabbedPane. |
913 |
* |
* |
914 |
* @param title The title of the tab. |
* @param title the title of the tab; may be <code>null</code> |
915 |
* @param icon The icon for the tab. |
* @param icon the icon for the tab; may be <code>null</code> |
916 |
* @param component The associated component. |
* @param component the associated component |
917 |
* @param tip The associated tooltip. |
* @param tip the associated tooltip |
918 |
*/ |
*/ |
919 |
public void addTab(String title, Icon icon, Component component, String tip) |
public void addTab(String title, Icon icon, Component component, String tip) |
920 |
{ |
{ |
924 |
/** |
/** |
925 |
* This method adds a tab to the JTabbedPane. |
* This method adds a tab to the JTabbedPane. |
926 |
* |
* |
927 |
* @param title The title of the tab. |
* @param title the title of the tab; may be <code>null</code> |
928 |
* @param icon The icon for the tab. |
* @param icon the icon for the tab; may be <code>null</code> |
929 |
* @param component The associated component. |
* @param component the associated component |
930 |
*/ |
*/ |
931 |
public void addTab(String title, Icon icon, Component component) |
public void addTab(String title, Icon icon, Component component) |
932 |
{ |
{ |
936 |
/** |
/** |
937 |
* This method adds a tab to the JTabbedPane. |
* This method adds a tab to the JTabbedPane. |
938 |
* |
* |
939 |
* @param title The title of the tab. |
* @param title the title of the tab; may be <code>null</code> |
940 |
* @param component The associated component. |
* @param component the associated component |
941 |
*/ |
*/ |
942 |
public void addTab(String title, Component component) |
public void addTab(String title, Component component) |
943 |
{ |
{ |
968 |
* instance of UIResource, it doesn't add the tab and instead add the |
* instance of UIResource, it doesn't add the tab and instead add the |
969 |
* component directly to the JTabbedPane. |
* component directly to the JTabbedPane. |
970 |
* |
* |
971 |
* @param title The title of the tab. |
* @param title the title of the tab; may be <code>null</code> |
972 |
* @param component The associated component. |
* @param component the associated component |
973 |
* |
* |
974 |
* @return The Component that was added. |
* @return The Component that was added. |
975 |
*/ |
*/ |