< prev index next >
src/java.desktop/share/classes/javax/swing/JTabbedPane.java
Print this page
*** 44,67 ****
* clicking on a tab with a given title and/or icon.
* For examples and information on using tabbed panes see
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html">How to Use Tabbed Panes</a>,
* a section in <em>The Java Tutorial</em>.
* <p>
! * Tabs/components are added to a <code>TabbedPane</code> object by using the
! * <code>addTab</code> and <code>insertTab</code> methods.
* A tab is represented by an index corresponding
* to the position it was added in, where the first tab has an index equal to 0
* and the last tab has an index equal to the tab count minus 1.
* <p>
! * The <code>TabbedPane</code> uses a <code>SingleSelectionModel</code>
* to represent the set
* of tab indices and the currently selected index. If the tab count
* is greater than 0, then there will always be a selected index, which
* by default will be initialized to the first tab. If the tab count is
* 0, then the selected index will be -1.
* <p>
! * The tab title can be rendered by a <code>Component</code>.
* For example, the following produce similar results:
* <pre>
* // In this case the look and feel renders the title for the tab.
* tabbedPane.addTab("Tab", myComponent);
* // In this case the custom component is responsible for rendering the
--- 44,67 ----
* clicking on a tab with a given title and/or icon.
* For examples and information on using tabbed panes see
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html">How to Use Tabbed Panes</a>,
* a section in <em>The Java Tutorial</em>.
* <p>
! * Tabs/components are added to a {@code TabbedPane} object by using the
! * {@code addTab} and {@code insertTab} methods.
* A tab is represented by an index corresponding
* to the position it was added in, where the first tab has an index equal to 0
* and the last tab has an index equal to the tab count minus 1.
* <p>
! * The {@code TabbedPane} uses a {@code SingleSelectionModel}
* to represent the set
* of tab indices and the currently selected index. If the tab count
* is greater than 0, then there will always be a selected index, which
* by default will be initialized to the first tab. If the tab count is
* 0, then the selected index will be -1.
* <p>
! * The tab title can be rendered by a {@code Component}.
* For example, the following produce similar results:
* <pre>
* // In this case the look and feel renders the title for the tab.
* tabbedPane.addTab("Tab", myComponent);
* // In this case the custom component is responsible for rendering the
*** 72,87 ****
* The latter is typically used when you want a more complex user interaction
* that requires custom components on the tab. For example, you could
* provide a custom component that animates or one that has widgets for
* closing the tab.
* <p>
! * If you specify a component for a tab, the <code>JTabbedPane</code>
* will not render any text or icon you have specified for the tab.
* <p>
* <strong>Note:</strong>
! * Do not use <code>setVisible</code> directly on a tab component to make it visible,
! * use <code>setSelectedComponent</code> or <code>setSelectedIndex</code> methods instead.
* <p>
* <strong>Warning:</strong> Swing is not thread safe. For more
* information see <a
* href="package-summary.html#threading">Swing's Threading
* Policy</a>.
--- 72,87 ----
* The latter is typically used when you want a more complex user interaction
* that requires custom components on the tab. For example, you could
* provide a custom component that animates or one that has widgets for
* closing the tab.
* <p>
! * If you specify a component for a tab, the {@code JTabbedPane}
* will not render any text or icon you have specified for the tab.
* <p>
* <strong>Note:</strong>
! * Do not use {@code setVisible} directly on a tab component to make it visible,
! * use {@code setSelectedComponent} or {@code setSelectedIndex} methods instead.
* <p>
* <strong>Warning:</strong> Swing is not thread safe. For more
* information see <a
* href="package-summary.html#threading">Swing's Threading
* Policy</a>.
*** 90,100 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @beaninfo
* attribute: isContainer true
* description: A component which provides a tab folder metaphor for
--- 90,100 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @beaninfo
* attribute: isContainer true
* description: A component which provides a tab folder metaphor for
*** 144,199 ****
protected SingleSelectionModel model;
private boolean haveRegistered;
/**
! * The <code>changeListener</code> is the listener we add to the
* model.
*/
protected ChangeListener changeListener = null;
private final java.util.List<Page> pages;
/* The component that is currently visible */
private Component visComp = null;
/**
! * Only one <code>ChangeEvent</code> is needed per <code>TabPane</code>
* instance since the
* event's only (read-only) state is the source property. The source
* of events generated here is always "this".
*/
protected transient ChangeEvent changeEvent = null;
/**
! * Creates an empty <code>TabbedPane</code> with a default
! * tab placement of <code>JTabbedPane.TOP</code>.
* @see #addTab
*/
public JTabbedPane() {
this(TOP, WRAP_TAB_LAYOUT);
}
/**
! * Creates an empty <code>TabbedPane</code> with the specified tab placement
! * of either: <code>JTabbedPane.TOP</code>, <code>JTabbedPane.BOTTOM</code>,
! * <code>JTabbedPane.LEFT</code>, or <code>JTabbedPane.RIGHT</code>.
*
* @param tabPlacement the placement for the tabs relative to the content
* @see #addTab
*/
public JTabbedPane(int tabPlacement) {
this(tabPlacement, WRAP_TAB_LAYOUT);
}
/**
! * Creates an empty <code>TabbedPane</code> with the specified tab placement
* and tab layout policy. Tab placement may be either:
! * <code>JTabbedPane.TOP</code>, <code>JTabbedPane.BOTTOM</code>,
! * <code>JTabbedPane.LEFT</code>, or <code>JTabbedPane.RIGHT</code>.
! * Tab layout policy may be either: <code>JTabbedPane.WRAP_TAB_LAYOUT</code>
! * or <code>JTabbedPane.SCROLL_TAB_LAYOUT</code>.
*
* @param tabPlacement the placement for the tabs relative to the content
* @param tabLayoutPolicy the policy for laying out tabs when all tabs will not fit on one run
* @exception IllegalArgumentException if tab placement or tab layout policy are not
* one of the above supported values
--- 144,199 ----
protected SingleSelectionModel model;
private boolean haveRegistered;
/**
! * The {@code changeListener} is the listener we add to the
* model.
*/
protected ChangeListener changeListener = null;
private final java.util.List<Page> pages;
/* The component that is currently visible */
private Component visComp = null;
/**
! * Only one {@code ChangeEvent} is needed per {@code TabPane}
* instance since the
* event's only (read-only) state is the source property. The source
* of events generated here is always "this".
*/
protected transient ChangeEvent changeEvent = null;
/**
! * Creates an empty {@code TabbedPane} with a default
! * tab placement of {@code JTabbedPane.TOP}.
* @see #addTab
*/
public JTabbedPane() {
this(TOP, WRAP_TAB_LAYOUT);
}
/**
! * Creates an empty {@code TabbedPane} with the specified tab placement
! * of either: {@code JTabbedPane.TOP}, {@code JTabbedPane.BOTTOM},
! * {@code JTabbedPane.LEFT}, or {@code JTabbedPane.RIGHT}.
*
* @param tabPlacement the placement for the tabs relative to the content
* @see #addTab
*/
public JTabbedPane(int tabPlacement) {
this(tabPlacement, WRAP_TAB_LAYOUT);
}
/**
! * Creates an empty {@code TabbedPane} with the specified tab placement
* and tab layout policy. Tab placement may be either:
! * {@code JTabbedPane.TOP}, {@code JTabbedPane.BOTTOM},
! * {@code JTabbedPane.LEFT}, or {@code JTabbedPane.RIGHT}.
! * Tab layout policy may be either: {@code JTabbedPane.WRAP_TAB_LAYOUT}
! * or {@code JTabbedPane.SCROLL_TAB_LAYOUT}.
*
* @param tabPlacement the placement for the tabs relative to the content
* @param tabLayoutPolicy the policy for laying out tabs when all tabs will not fit on one run
* @exception IllegalArgumentException if tab placement or tab layout policy are not
* one of the above supported values
*** 209,219 ****
}
/**
* Returns the UI object which implements the L&F for this component.
*
! * @return a <code>TabbedPaneUI</code> object
* @see #setUI
*/
public TabbedPaneUI getUI() {
return (TabbedPaneUI)ui;
}
--- 209,219 ----
}
/**
* Returns the UI object which implements the L&F for this component.
*
! * @return a {@code TabbedPaneUI} object
* @see #setUI
*/
public TabbedPaneUI getUI() {
return (TabbedPaneUI)ui;
}
*** 262,319 ****
return uiClassID;
}
/**
! * We pass <code>ModelChanged</code> events along to the listeners with
* the tabbedpane (instead of the model itself) as the event source.
*/
protected class ModelListener implements ChangeListener, Serializable {
public void stateChanged(ChangeEvent e) {
fireStateChanged();
}
}
/**
! * Subclasses that want to handle <code>ChangeEvents</code> differently
! * can override this to return a subclass of <code>ModelListener</code> or
! * another <code>ChangeListener</code> implementation.
*
* @return a {@code ChangeListener}
* @see #fireStateChanged
*/
protected ChangeListener createChangeListener() {
return new ModelListener();
}
/**
! * Adds a <code>ChangeListener</code> to this tabbedpane.
*
! * @param l the <code>ChangeListener</code> to add
* @see #fireStateChanged
* @see #removeChangeListener
*/
public void addChangeListener(ChangeListener l) {
listenerList.add(ChangeListener.class, l);
}
/**
! * Removes a <code>ChangeListener</code> from this tabbedpane.
*
! * @param l the <code>ChangeListener</code> to remove
* @see #fireStateChanged
* @see #addChangeListener
*/
public void removeChangeListener(ChangeListener l) {
listenerList.remove(ChangeListener.class, l);
}
/**
! * Returns an array of all the <code>ChangeListener</code>s added
! * to this <code>JTabbedPane</code> with <code>addChangeListener</code>.
*
! * @return all of the <code>ChangeListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return listenerList.getListeners(ChangeListener.class);
--- 262,319 ----
return uiClassID;
}
/**
! * We pass {@code ModelChanged} events along to the listeners with
* the tabbedpane (instead of the model itself) as the event source.
*/
protected class ModelListener implements ChangeListener, Serializable {
public void stateChanged(ChangeEvent e) {
fireStateChanged();
}
}
/**
! * Subclasses that want to handle {@code ChangeEvents} differently
! * can override this to return a subclass of {@code ModelListener} or
! * another {@code ChangeListener} implementation.
*
* @return a {@code ChangeListener}
* @see #fireStateChanged
*/
protected ChangeListener createChangeListener() {
return new ModelListener();
}
/**
! * Adds a {@code ChangeListener} to this tabbedpane.
*
! * @param l the {@code ChangeListener} to add
* @see #fireStateChanged
* @see #removeChangeListener
*/
public void addChangeListener(ChangeListener l) {
listenerList.add(ChangeListener.class, l);
}
/**
! * Removes a {@code ChangeListener} from this tabbedpane.
*
! * @param l the {@code ChangeListener} to remove
* @see #fireStateChanged
* @see #addChangeListener
*/
public void removeChangeListener(ChangeListener l) {
listenerList.remove(ChangeListener.class, l);
}
/**
! * Returns an array of all the {@code ChangeListener}s added
! * to this {@code JTabbedPane} with {@code addChangeListener}.
*
! * @return all of the {@code ChangeListener}s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return listenerList.getListeners(ChangeListener.class);
*** 471,486 ****
}
/**
* Sets the tab placement for this tabbedpane.
* Possible values are:<ul>
! * <li><code>JTabbedPane.TOP</code>
! * <li><code>JTabbedPane.BOTTOM</code>
! * <li><code>JTabbedPane.LEFT</code>
! * <li><code>JTabbedPane.RIGHT</code>
* </ul>
! * The default value, if not set, is <code>SwingConstants.TOP</code>.
*
* @param tabPlacement the placement for the tabs relative to the content
* @exception IllegalArgumentException if tab placement value isn't one
* of the above valid values
*
--- 471,486 ----
}
/**
* Sets the tab placement for this tabbedpane.
* Possible values are:<ul>
! * <li>{@code JTabbedPane.TOP}
! * <li>{@code JTabbedPane.BOTTOM}
! * <li>{@code JTabbedPane.LEFT}
! * <li>{@code JTabbedPane.RIGHT}
* </ul>
! * The default value, if not set, is {@code SwingConstants.TOP}.
*
* @param tabPlacement the placement for the tabs relative to the content
* @exception IllegalArgumentException if tab placement value isn't one
* of the above valid values
*
*** 529,543 ****
/**
* Sets the policy which the tabbedpane will use in laying out the tabs
* when all the tabs will not fit within a single run.
* Possible values are:
* <ul>
! * <li><code>JTabbedPane.WRAP_TAB_LAYOUT</code>
! * <li><code>JTabbedPane.SCROLL_TAB_LAYOUT</code>
* </ul>
*
! * The default value, if not set by the UI, is <code>JTabbedPane.WRAP_TAB_LAYOUT</code>.
* <p>
* Some look and feels might only support a subset of the possible
* layout policies, in which case the value of this property may be
* ignored.
*
--- 529,543 ----
/**
* Sets the policy which the tabbedpane will use in laying out the tabs
* when all the tabs will not fit within a single run.
* Possible values are:
* <ul>
! * <li>{@code JTabbedPane.WRAP_TAB_LAYOUT}
! * <li>{@code JTabbedPane.SCROLL_TAB_LAYOUT}
* </ul>
*
! * The default value, if not set by the UI, is {@code JTabbedPane.WRAP_TAB_LAYOUT}.
* <p>
* Some look and feels might only support a subset of the possible
* layout policies, in which case the value of this property may be
* ignored.
*
*** 661,671 ****
accessibleContext.getAccessibleName());
}
/**
* Returns the currently selected component for this tabbedpane.
! * Returns <code>null</code> if there is no currently selected tab.
*
* @return the component corresponding to the selected tab
* @see #setSelectedComponent
*/
@Transient
--- 661,671 ----
accessibleContext.getAccessibleName());
}
/**
* Returns the currently selected component for this tabbedpane.
! * Returns {@code null} if there is no currently selected tab.
*
* @return the component corresponding to the selected tab
* @see #setSelectedComponent
*/
@Transient
*** 677,687 ****
return getComponentAt(index);
}
/**
* Sets the selected component for this tabbedpane. This
! * will automatically set the <code>selectedIndex</code> to the index
* corresponding to the specified component.
*
* @param c the selected {@code Component} for this {@code TabbedPane}
* @exception IllegalArgumentException if component not found in tabbed
* pane
--- 677,687 ----
return getComponentAt(index);
}
/**
* Sets the selected component for this tabbedpane. This
! * will automatically set the {@code selectedIndex} to the index
* corresponding to the specified component.
*
* @param c the selected {@code Component} for this {@code TabbedPane}
* @exception IllegalArgumentException if component not found in tabbed
* pane
*** 769,782 ****
revalidate();
repaint();
}
/**
! * Adds a <code>component</code> and <code>tip</code>
! * represented by a <code>title</code> and/or <code>icon</code>,
! * either of which can be <code>null</code>.
! * Cover method for <code>insertTab</code>.
*
* @param title the title to be displayed in this tab
* @param icon the icon to be displayed in this tab
* @param component the component to be displayed when this tab is clicked
* @param tip the tooltip to be displayed for this tab
--- 769,782 ----
revalidate();
repaint();
}
/**
! * Adds a {@code component} and {@code tip}
! * represented by a {@code title} and/or {@code icon},
! * either of which can be {@code null}.
! * Cover method for {@code insertTab}.
*
* @param title the title to be displayed in this tab
* @param icon the icon to be displayed in this tab
* @param component the component to be displayed when this tab is clicked
* @param tip the tooltip to be displayed for this tab
*** 787,799 ****
public void addTab(String title, Icon icon, Component component, String tip) {
insertTab(title, icon, component, tip, pages.size());
}
/**
! * Adds a <code>component</code> represented by a <code>title</code>
! * and/or <code>icon</code>, either of which can be <code>null</code>.
! * Cover method for <code>insertTab</code>.
*
* @param title the title to be displayed in this tab
* @param icon the icon to be displayed in this tab
* @param component the component to be displayed when this tab is clicked
*
--- 787,799 ----
public void addTab(String title, Icon icon, Component component, String tip) {
insertTab(title, icon, component, tip, pages.size());
}
/**
! * Adds a {@code component} represented by a {@code title}
! * and/or {@code icon}, either of which can be {@code null}.
! * Cover method for {@code insertTab}.
*
* @param title the title to be displayed in this tab
* @param icon the icon to be displayed in this tab
* @param component the component to be displayed when this tab is clicked
*
*** 803,815 ****
public void addTab(String title, Icon icon, Component component) {
insertTab(title, icon, component, null, pages.size());
}
/**
! * Adds a <code>component</code> represented by a <code>title</code>
* and no icon.
! * Cover method for <code>insertTab</code>.
*
* @param title the title to be displayed in this tab
* @param component the component to be displayed when this tab is clicked
*
* @see #insertTab
--- 803,815 ----
public void addTab(String title, Icon icon, Component component) {
insertTab(title, icon, component, null, pages.size());
}
/**
! * Adds a {@code component} represented by a {@code title}
* and no icon.
! * Cover method for {@code insertTab}.
*
* @param title the title to be displayed in this tab
* @param component the component to be displayed when this tab is clicked
*
* @see #insertTab
*** 818,831 ****
public void addTab(String title, Component component) {
insertTab(title, null, component, null, pages.size());
}
/**
! * Adds a <code>component</code> with a tab title defaulting to
* the name of the component which is the result of calling
! * <code>component.getName</code>.
! * Cover method for <code>insertTab</code>.
*
* @param component the component to be displayed when this tab is clicked
* @return the component
*
* @see #insertTab
--- 818,831 ----
public void addTab(String title, Component component) {
insertTab(title, null, component, null, pages.size());
}
/**
! * Adds a {@code component} with a tab title defaulting to
* the name of the component which is the result of calling
! * {@code component.getName}.
! * Cover method for {@code insertTab}.
*
* @param component the component to be displayed when this tab is clicked
* @return the component
*
* @see #insertTab
*** 839,850 ****
}
return component;
}
/**
! * Adds a <code>component</code> with the specified tab title.
! * Cover method for <code>insertTab</code>.
*
* @param title the title to be displayed in this tab
* @param component the component to be displayed when this tab is clicked
* @return the component
*
--- 839,850 ----
}
return component;
}
/**
! * Adds a {@code component} with the specified tab title.
! * Cover method for {@code insertTab}.
*
* @param title the title to be displayed in this tab
* @param component the component to be displayed when this tab is clicked
* @return the component
*
*** 859,871 ****
}
return component;
}
/**
! * Adds a <code>component</code> at the specified tab index with a tab
* title defaulting to the name of the component.
! * Cover method for <code>insertTab</code>.
*
* @param component the component to be displayed when this tab is clicked
* @param index the position to insert this new tab
* @return the component
*
--- 859,871 ----
}
return component;
}
/**
! * Adds a {@code component} at the specified tab index with a tab
* title defaulting to the name of the component.
! * Cover method for {@code insertTab}.
*
* @param component the component to be displayed when this tab is clicked
* @param index the position to insert this new tab
* @return the component
*
*** 883,897 ****
}
return component;
}
/**
! * Adds a <code>component</code> to the tabbed pane.
! * If <code>constraints</code> is a <code>String</code> or an
! * <code>Icon</code>, it will be used for the tab title,
* otherwise the component's name will be used as the tab title.
! * Cover method for <code>insertTab</code>.
*
* @param component the component to be displayed when this tab is clicked
* @param constraints the object to be displayed in the tab
*
* @see #insertTab
--- 883,897 ----
}
return component;
}
/**
! * Adds a {@code component} to the tabbed pane.
! * If {@code constraints} is a {@code String} or an
! * {@code Icon}, it will be used for the tab title,
* otherwise the component's name will be used as the tab title.
! * Cover method for {@code insertTab}.
*
* @param component the component to be displayed when this tab is clicked
* @param constraints the object to be displayed in the tab
*
* @see #insertTab
*** 910,924 ****
super.add(component, constraints);
}
}
/**
! * Adds a <code>component</code> at the specified tab index.
! * If <code>constraints</code> is a <code>String</code> or an
! * <code>Icon</code>, it will be used for the tab title,
* otherwise the component's name will be used as the tab title.
! * Cover method for <code>insertTab</code>.
*
* @param component the component to be displayed when this tab is clicked
* @param constraints the object to be displayed in the tab
* @param index the position to insert this new tab
*
--- 910,924 ----
super.add(component, constraints);
}
}
/**
! * Adds a {@code component} at the specified tab index.
! * If {@code constraints} is a {@code String} or an
! * {@code Icon}, it will be used for the tab title,
* otherwise the component's name will be used as the tab title.
! * Cover method for {@code insertTab}.
*
* @param component the component to be displayed when this tab is clicked
* @param constraints the object to be displayed in the tab
* @param index the position to insert this new tab
*
*** 937,948 ****
super.add(component, constraints, index);
}
}
/**
! * Removes the tab at <code>index</code>.
! * After the component associated with <code>index</code> is removed,
* its visibility is reset to true to ensure it will be visible
* if added to other containers.
* @param index the index of the tab to be removed
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
--- 937,948 ----
super.add(component, constraints, index);
}
}
/**
! * Removes the tab at {@code index}.
! * After the component associated with {@code index} is removed,
* its visibility is reset to true to ensure it will be visible
* if added to other containers.
* @param index the index of the tab to be removed
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*** 1032,1044 ****
revalidate();
repaint();
}
/**
! * Removes the specified <code>Component</code> from the
! * <code>JTabbedPane</code>. The method does nothing
! * if the <code>component</code> is null.
*
* @param component the component to remove from the tabbedpane
* @see #addTab
* @see #removeTabAt
*/
--- 1032,1044 ----
revalidate();
repaint();
}
/**
! * Removes the specified {@code Component} from the
! * {@code JTabbedPane}. The method does nothing
! * if the {@code component} is null.
*
* @param component the component to remove from the tabbedpane
* @see #addTab
* @see #removeTabAt
*/
*** 1061,1071 ****
/**
* Removes the tab and component which corresponds to the specified index.
*
* @param index the index of the component to remove from the
! * <code>tabbedpane</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
* @see #addTab
* @see #removeTabAt
*/
--- 1061,1071 ----
/**
* Removes the tab and component which corresponds to the specified index.
*
* @param index the index of the component to remove from the
! * {@code tabbedpane}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
* @see #addTab
* @see #removeTabAt
*/
*** 1073,1083 ****
removeTabAt(index);
}
/**
* Removes all the tabs and their corresponding components
! * from the <code>tabbedpane</code>.
*
* @see #addTab
* @see #removeTabAt
*/
public void removeAll() {
--- 1073,1083 ----
removeTabAt(index);
}
/**
* Removes all the tabs and their corresponding components
! * from the {@code tabbedpane}.
*
* @see #addTab
* @see #removeTabAt
*/
public void removeAll() {
*** 1090,1100 ****
removeTabAt(tabCount);
}
}
/**
! * Returns the number of tabs in this <code>tabbedpane</code>.
*
* @return an integer specifying the number of tabbed pages
*/
public int getTabCount() {
return pages.size();
--- 1090,1100 ----
removeTabAt(tabCount);
}
}
/**
! * Returns the number of tabs in this {@code tabbedpane}.
*
* @return an integer specifying the number of tabbed pages
*/
public int getTabCount() {
return pages.size();
*** 1102,1117 ****
/**
* Returns the number of tab runs currently used to display
* the tabs.
* @return an integer giving the number of rows if the
! * <code>tabPlacement</code>
! * is <code>TOP</code> or <code>BOTTOM</code>
* and the number of columns if
! * <code>tabPlacement</code>
! * is <code>LEFT</code> or <code>RIGHT</code>,
! * or 0 if there is no UI set on this <code>tabbedpane</code>
*/
public int getTabRunCount() {
if (ui != null) {
return ((TabbedPaneUI)ui).getTabRunCount(this);
}
--- 1102,1117 ----
/**
* Returns the number of tab runs currently used to display
* the tabs.
* @return an integer giving the number of rows if the
! * {@code tabPlacement}
! * is {@code TOP} or {@code BOTTOM}
* and the number of columns if
! * {@code tabPlacement}
! * is {@code LEFT} or {@code RIGHT},
! * or 0 if there is no UI set on this {@code tabbedpane}
*/
public int getTabRunCount() {
if (ui != null) {
return ((TabbedPaneUI)ui).getTabRunCount(this);
}
*** 1120,1165 ****
// Getters for the Pages
/**
! * Returns the tab title at <code>index</code>.
*
* @param index the index of the item being queried
! * @return the title at <code>index</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
* @see #setTitleAt
*/
public String getTitleAt(int index) {
return pages.get(index).title;
}
/**
! * Returns the tab icon at <code>index</code>.
*
* @param index the index of the item being queried
! * @return the icon at <code>index</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setIconAt
*/
public Icon getIconAt(int index) {
return pages.get(index).icon;
}
/**
! * Returns the tab disabled icon at <code>index</code>.
! * If the tab disabled icon doesn't exist at <code>index</code>
* this will forward the call to the look and feel to construct
* an appropriate disabled Icon from the corresponding enabled
* Icon. Some look and feels might not render the disabled Icon,
* in which case it won't be created.
*
* @param index the index of the item being queried
! * @return the icon at <code>index</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setDisabledIconAt
*/
--- 1120,1165 ----
// Getters for the Pages
/**
! * Returns the tab title at {@code index}.
*
* @param index the index of the item being queried
! * @return the title at {@code index}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
* @see #setTitleAt
*/
public String getTitleAt(int index) {
return pages.get(index).title;
}
/**
! * Returns the tab icon at {@code index}.
*
* @param index the index of the item being queried
! * @return the icon at {@code index}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setIconAt
*/
public Icon getIconAt(int index) {
return pages.get(index).icon;
}
/**
! * Returns the tab disabled icon at {@code index}.
! * If the tab disabled icon doesn't exist at {@code index}
* this will forward the call to the look and feel to construct
* an appropriate disabled Icon from the corresponding enabled
* Icon. Some look and feels might not render the disabled Icon,
* in which case it won't be created.
*
* @param index the index of the item being queried
! * @return the icon at {@code index}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setDisabledIconAt
*/
*** 1170,1183 ****
}
return page.disabledIcon;
}
/**
! * Returns the tab tooltip text at <code>index</code>.
*
* @param index the index of the item being queried
! * @return a string containing the tool tip text at <code>index</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setToolTipTextAt
* @since 1.3
--- 1170,1183 ----
}
return page.disabledIcon;
}
/**
! * Returns the tab tooltip text at {@code index}.
*
* @param index the index of the item being queried
! * @return a string containing the tool tip text at {@code index}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setToolTipTextAt
* @since 1.3
*** 1185,1229 ****
public String getToolTipTextAt(int index) {
return pages.get(index).tip;
}
/**
! * Returns the tab background color at <code>index</code>.
*
* @param index the index of the item being queried
! * @return the <code>Color</code> of the tab background at
! * <code>index</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setBackgroundAt
*/
public Color getBackgroundAt(int index) {
return pages.get(index).getBackground();
}
/**
! * Returns the tab foreground color at <code>index</code>.
*
* @param index the index of the item being queried
! * @return the <code>Color</code> of the tab foreground at
! * <code>index</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setForegroundAt
*/
public Color getForegroundAt(int index) {
return pages.get(index).getForeground();
}
/**
! * Returns whether or not the tab at <code>index</code> is
* currently enabled.
*
* @param index the index of the item being queried
! * @return true if the tab at <code>index</code> is enabled;
* false otherwise
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setEnabledAt
--- 1185,1229 ----
public String getToolTipTextAt(int index) {
return pages.get(index).tip;
}
/**
! * Returns the tab background color at {@code index}.
*
* @param index the index of the item being queried
! * @return the {@code Color} of the tab background at
! * {@code index}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setBackgroundAt
*/
public Color getBackgroundAt(int index) {
return pages.get(index).getBackground();
}
/**
! * Returns the tab foreground color at {@code index}.
*
* @param index the index of the item being queried
! * @return the {@code Color} of the tab foreground at
! * {@code index}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setForegroundAt
*/
public Color getForegroundAt(int index) {
return pages.get(index).getForeground();
}
/**
! * Returns whether or not the tab at {@code index} is
* currently enabled.
*
* @param index the index of the item being queried
! * @return true if the tab at {@code index} is enabled;
* false otherwise
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setEnabledAt
*** 1231,1244 ****
public boolean isEnabledAt(int index) {
return pages.get(index).isEnabled();
}
/**
! * Returns the component at <code>index</code>.
*
* @param index the index of the item being queried
! * @return the <code>Component</code> at <code>index</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setComponentAt
*/
--- 1231,1244 ----
public boolean isEnabledAt(int index) {
return pages.get(index).isEnabled();
}
/**
! * Returns the component at {@code index}.
*
* @param index the index of the item being queried
! * @return the {@code Component} at {@code index}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setComponentAt
*/
*** 1255,1266 ****
* @since 1.4
* @param tabIndex the index of the tab that the mnemonic refers to
* @return the key code which represents the mnemonic;
* -1 if a mnemonic is not specified for the tab
* @exception IndexOutOfBoundsException if index is out of range
! * (<code>tabIndex</code> < 0 ||
! * <code>tabIndex</code> >= tab count)
* @see #setDisplayedMnemonicIndexAt(int,int)
* @see #setMnemonicAt(int,int)
*/
public int getMnemonicAt(int tabIndex) {
checkIndex(tabIndex);
--- 1255,1266 ----
* @since 1.4
* @param tabIndex the index of the tab that the mnemonic refers to
* @return the key code which represents the mnemonic;
* -1 if a mnemonic is not specified for the tab
* @exception IndexOutOfBoundsException if index is out of range
! * ({@code tabIndex < 0 ||
! * tabIndex >= tab count})
* @see #setDisplayedMnemonicIndexAt(int,int)
* @see #setMnemonicAt(int,int)
*/
public int getMnemonicAt(int tabIndex) {
checkIndex(tabIndex);
*** 1276,1287 ****
* @since 1.4
* @param tabIndex the index of the tab that the mnemonic refers to
* @return index representing mnemonic character if one exists;
* otherwise returns -1
* @exception IndexOutOfBoundsException if index is out of range
! * (<code>tabIndex</code> < 0 ||
! * <code>tabIndex</code> >= tab count)
* @see #setDisplayedMnemonicIndexAt(int,int)
* @see #setMnemonicAt(int,int)
*/
public int getDisplayedMnemonicIndexAt(int tabIndex) {
checkIndex(tabIndex);
--- 1276,1287 ----
* @since 1.4
* @param tabIndex the index of the tab that the mnemonic refers to
* @return index representing mnemonic character if one exists;
* otherwise returns -1
* @exception IndexOutOfBoundsException if index is out of range
! * ({@code tabIndex < 0 ||
! * tabIndex >= tab count})
* @see #setDisplayedMnemonicIndexAt(int,int)
* @see #setMnemonicAt(int,int)
*/
public int getDisplayedMnemonicIndexAt(int tabIndex) {
checkIndex(tabIndex);
*** 1289,1309 ****
Page page = pages.get(tabIndex);
return page.getDisplayedMnemonicIndex();
}
/**
! * Returns the tab bounds at <code>index</code>. If the tab at
* this index is not currently visible in the UI, then returns
! * <code>null</code>.
! * If there is no UI set on this <code>tabbedpane</code>,
! * then returns <code>null</code>.
*
* @param index the index to be queried
! * @return a <code>Rectangle</code> containing the tab bounds at
! * <code>index</code>, or <code>null</code> if tab at
! * <code>index</code> is not currently visible in the UI,
! * or if there is no UI set on this <code>tabbedpane</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*/
public Rectangle getBoundsAt(int index) {
checkIndex(index);
--- 1289,1309 ----
Page page = pages.get(tabIndex);
return page.getDisplayedMnemonicIndex();
}
/**
! * Returns the tab bounds at {@code index}. If the tab at
* this index is not currently visible in the UI, then returns
! * {@code null}.
! * If there is no UI set on this {@code tabbedpane},
! * then returns {@code null}.
*
* @param index the index to be queried
! * @return a {@code Rectangle} containing the tab bounds at
! * {@code index}, or {@code null} if tab at
! * {@code index} is not currently visible in the UI,
! * or if there is no UI set on this {@code tabbedpane}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*/
public Rectangle getBoundsAt(int index) {
checkIndex(index);
*** 1315,1326 ****
// Setters for the Pages
/**
! * Sets the title at <code>index</code> to <code>title</code> which
! * can be <code>null</code>.
* The title is not shown if a tab component for this tab was specified.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where the title should be set
* @param title the title to be displayed in the tab
--- 1315,1326 ----
// Setters for the Pages
/**
! * Sets the title at {@code index} to {@code title} which
! * can be {@code null}.
* The title is not shown if a tab component for this tab was specified.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where the title should be set
* @param title the title to be displayed in the tab
*** 1354,1368 ****
repaint();
}
}
/**
! * Sets the icon at <code>index</code> to <code>icon</code> which can be
! * <code>null</code>. This does not set disabled icon at <code>icon</code>.
* If the new Icon is different than the current Icon and disabled icon
* is not explicitly set, the LookAndFeel will be asked to generate a disabled
! * Icon. To explicitly set disabled icon, use <code>setDisableIconAt()</code>.
* The icon is not shown if a tab component for this tab was specified.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where the icon should be set
* @param icon the icon to be displayed in the tab
--- 1354,1368 ----
repaint();
}
}
/**
! * Sets the icon at {@code index} to {@code icon} which can be
! * {@code null}. This does not set disabled icon at {@code icon}.
* If the new Icon is different than the current Icon and disabled icon
* is not explicitly set, the LookAndFeel will be asked to generate a disabled
! * Icon. To explicitly set disabled icon, use {@code setDisableIconAt()}.
* The icon is not shown if a tab component for this tab was specified.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where the icon should be set
* @param icon the icon to be displayed in the tab
*** 1402,1413 ****
repaint();
}
}
/**
! * Sets the disabled icon at <code>index</code> to <code>icon</code>
! * which can be <code>null</code>.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where the disabled icon should be set
* @param disabledIcon the icon to be displayed in the tab when disabled
* @exception IndexOutOfBoundsException if index is out of range
--- 1402,1413 ----
repaint();
}
}
/**
! * Sets the disabled icon at {@code index} to {@code icon}
! * which can be {@code null}.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where the disabled icon should be set
* @param disabledIcon the icon to be displayed in the tab when disabled
* @exception IndexOutOfBoundsException if index is out of range
*** 1427,1438 ****
repaint();
}
}
/**
! * Sets the tooltip text at <code>index</code> to <code>toolTipText</code>
! * which can be <code>null</code>.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where the tooltip text should be set
* @param toolTipText the tooltip text to be displayed for the tab
* @exception IndexOutOfBoundsException if index is out of range
--- 1427,1438 ----
repaint();
}
}
/**
! * Sets the tooltip text at {@code index} to {@code toolTipText}
! * which can be {@code null}.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where the tooltip text should be set
* @param toolTipText the tooltip text to be displayed for the tab
* @exception IndexOutOfBoundsException if index is out of range
*** 1458,1471 ****
haveRegistered = true;
}
}
/**
! * Sets the background color at <code>index</code> to
! * <code>background</code>
! * which can be <code>null</code>, in which case the tab's background color
! * will default to the background color of the <code>tabbedpane</code>.
* An internal exception is raised if there is no tab at that index.
* <p>
* It is up to the look and feel to honor this property, some may
* choose to ignore it.
*
--- 1458,1471 ----
haveRegistered = true;
}
}
/**
! * Sets the background color at {@code index} to
! * {@code background}
! * which can be {@code null}, in which case the tab's background color
! * will default to the background color of the {@code tabbedpane}.
* An internal exception is raised if there is no tab at that index.
* <p>
* It is up to the look and feel to honor this property, some may
* choose to ignore it.
*
*** 1491,1504 ****
}
}
}
/**
! * Sets the foreground color at <code>index</code> to
! * <code>foreground</code> which can be
! * <code>null</code>, in which case the tab's foreground color
! * will default to the foreground color of this <code>tabbedpane</code>.
* An internal exception is raised if there is no tab at that index.
* <p>
* It is up to the look and feel to honor this property, some may
* choose to ignore it.
*
--- 1491,1504 ----
}
}
}
/**
! * Sets the foreground color at {@code index} to
! * {@code foreground} which can be
! * {@code null}, in which case the tab's foreground color
! * will default to the foreground color of this {@code tabbedpane}.
* An internal exception is raised if there is no tab at that index.
* <p>
* It is up to the look and feel to honor this property, some may
* choose to ignore it.
*
*** 1524,1534 ****
}
}
}
/**
! * Sets whether or not the tab at <code>index</code> is enabled.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index which should be enabled/disabled
* @param enabled whether or not the tab should be enabled
* @exception IndexOutOfBoundsException if index is out of range
--- 1524,1534 ----
}
}
}
/**
! * Sets whether or not the tab at {@code index} is enabled.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index which should be enabled/disabled
* @param enabled whether or not the tab should be enabled
* @exception IndexOutOfBoundsException if index is out of range
*** 1544,1554 ****
repaint();
}
}
/**
! * Sets the component at <code>index</code> to <code>component</code>.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where this component is being placed
* @param component the component for the tab
* @exception IndexOutOfBoundsException if index is out of range
--- 1544,1554 ----
repaint();
}
}
/**
! * Sets the component at {@code index} to {@code component}.
* An internal exception is raised if there is no tab at that index.
*
* @param index the tab index where this component is being placed
* @param component the component for the tab
* @exception IndexOutOfBoundsException if index is out of range
*** 1616,1639 ****
* You should only ever have to call this if
* you do not wish the default character to be underlined. For example, if
* the text at tab index 3 was 'Apple Price', with a mnemonic of 'p',
* and you wanted the 'P'
* to be decorated, as 'Apple <u>P</u>rice', you would have to invoke
! * <code>setDisplayedMnemonicIndex(3, 6)</code> after invoking
! * <code>setMnemonicAt(3, KeyEvent.VK_P)</code>.
* <p>Note that it is the programmer's responsibility to ensure
* that each tab has a unique mnemonic or unpredictable results may
* occur.
*
* @since 1.4
* @param tabIndex the index of the tab that the mnemonic refers to
! * @param mnemonicIndex index into the <code>String</code> to underline
! * @exception IndexOutOfBoundsException if <code>tabIndex</code> is
* out of range ({@code tabIndex < 0 || tabIndex >= tab
* count})
* @exception IllegalArgumentException will be thrown if
! * <code>mnemonicIndex</code> is >= length of the tab
* title , or < -1
* @see #setMnemonicAt(int,int)
* @see #getDisplayedMnemonicIndexAt(int)
*
* @beaninfo
--- 1616,1639 ----
* You should only ever have to call this if
* you do not wish the default character to be underlined. For example, if
* the text at tab index 3 was 'Apple Price', with a mnemonic of 'p',
* and you wanted the 'P'
* to be decorated, as 'Apple <u>P</u>rice', you would have to invoke
! * {@code setDisplayedMnemonicIndex(3, 6)} after invoking
! * {@code setMnemonicAt(3, KeyEvent.VK_P)}.
* <p>Note that it is the programmer's responsibility to ensure
* that each tab has a unique mnemonic or unpredictable results may
* occur.
*
* @since 1.4
* @param tabIndex the index of the tab that the mnemonic refers to
! * @param mnemonicIndex index into the {@code String} to underline
! * @exception IndexOutOfBoundsException if {@code tabIndex} is
* out of range ({@code tabIndex < 0 || tabIndex >= tab
* count})
* @exception IllegalArgumentException will be thrown if
! * {@code mnemonicIndex} is >= length of the tab
* title , or < -1
* @see #setMnemonicAt(int,int)
* @see #getDisplayedMnemonicIndexAt(int)
*
* @beaninfo
*** 1655,1679 ****
* The mnemonic is the key which when combined with the look and feel's
* mouseless modifier (usually Alt) will activate the specified
* tab.
* <p>
* A mnemonic must correspond to a single key on the keyboard
! * and should be specified using one of the <code>VK_XXX</code>
! * keycodes defined in <code>java.awt.event.KeyEvent</code>
* or one of the extended keycodes obtained through
! * <code>java.awt.event.KeyEvent.getExtendedKeyCodeForChar</code>.
* Mnemonics are case-insensitive, therefore a key event
* with the corresponding keycode would cause the button to be
* activated whether or not the Shift modifier was pressed.
* <p>
* This will update the displayed mnemonic property for the specified
* tab.
*
* @since 1.4
* @param tabIndex the index of the tab that the mnemonic refers to
* @param mnemonic the key code which represents the mnemonic
! * @exception IndexOutOfBoundsException if <code>tabIndex</code> is out
* of range ({@code tabIndex < 0 || tabIndex >= tab count})
* @see #getMnemonicAt(int)
* @see #setDisplayedMnemonicIndexAt(int,int)
*
* @beaninfo
--- 1655,1679 ----
* The mnemonic is the key which when combined with the look and feel's
* mouseless modifier (usually Alt) will activate the specified
* tab.
* <p>
* A mnemonic must correspond to a single key on the keyboard
! * and should be specified using one of the {@code VK_XXX}
! * keycodes defined in {@code java.awt.event.KeyEvent}
* or one of the extended keycodes obtained through
! * {@code java.awt.event.KeyEvent.getExtendedKeyCodeForChar}.
* Mnemonics are case-insensitive, therefore a key event
* with the corresponding keycode would cause the button to be
* activated whether or not the Shift modifier was pressed.
* <p>
* This will update the displayed mnemonic property for the specified
* tab.
*
* @since 1.4
* @param tabIndex the index of the tab that the mnemonic refers to
* @param mnemonic the key code which represents the mnemonic
! * @exception IndexOutOfBoundsException if {@code tabIndex} is out
* of range ({@code tabIndex < 0 || tabIndex >= tab count})
* @see #getMnemonicAt(int)
* @see #setDisplayedMnemonicIndexAt(int,int)
*
* @beaninfo
*** 1692,1706 ****
}
// end of Page setters
/**
! * Returns the first tab index with a given <code>title</code>, or
* -1 if no tab has this title.
*
* @param title the title for the tab
! * @return the first tab index which matches <code>title</code>, or
* -1 if no tab has this title
*/
public int indexOfTab(String title) {
for(int i = 0; i < getTabCount(); i++) {
if (getTitleAt(i).equals(title == null? "" : title)) {
--- 1692,1706 ----
}
// end of Page setters
/**
! * Returns the first tab index with a given {@code title}, or
* -1 if no tab has this title.
*
* @param title the title for the tab
! * @return the first tab index which matches {@code title}, or
* -1 if no tab has this title
*/
public int indexOfTab(String title) {
for(int i = 0; i < getTabCount(); i++) {
if (getTitleAt(i).equals(title == null? "" : title)) {
*** 1709,1723 ****
}
return -1;
}
/**
! * Returns the first tab index with a given <code>icon</code>,
* or -1 if no tab has this icon.
*
* @param icon the icon for the tab
! * @return the first tab index which matches <code>icon</code>,
* or -1 if no tab has this icon
*/
public int indexOfTab(Icon icon) {
for(int i = 0; i < getTabCount(); i++) {
Icon tabIcon = getIconAt(i);
--- 1709,1723 ----
}
return -1;
}
/**
! * Returns the first tab index with a given {@code icon},
* or -1 if no tab has this icon.
*
* @param icon the icon for the tab
! * @return the first tab index which matches {@code icon},
* or -1 if no tab has this icon
*/
public int indexOfTab(Icon icon) {
for(int i = 0; i < getTabCount(); i++) {
Icon tabIcon = getIconAt(i);
*** 1769,1781 ****
/**
* Returns the tooltip text for the component determined by the
* mouse event location.
*
! * @param event the <code>MouseEvent</code> that tells where the
* cursor is lingering
! * @return the <code>String</code> containing the tooltip text
*/
public String getToolTipText(MouseEvent event) {
if (ui != null) {
int index = ((TabbedPaneUI)ui).tabForCoordinate(this, event.getX(), event.getY());
--- 1769,1781 ----
/**
* Returns the tooltip text for the component determined by the
* mouse event location.
*
! * @param event the {@code MouseEvent} that tells where the
* cursor is lingering
! * @return the {@code String} containing the tooltip text
*/
public String getToolTipText(MouseEvent event) {
if (ui != null) {
int index = ((TabbedPaneUI)ui).tabForCoordinate(this, event.getX(), event.getY());
*** 1792,1803 ****
}
}
/**
! * See <code>readObject</code> and <code>writeObject</code> in
! * <code>JComponent</code> for more
* information about serialization in Swing.
*/
private void writeObject(ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
if (getUIClassID().equals(uiClassID)) {
--- 1792,1803 ----
}
}
/**
! * See {@code readObject} and {@code writeObject} in
! * {@code JComponent} for more
* information about serialization in Swing.
*/
private void writeObject(ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
if (getUIClassID().equals(uiClassID)) {
*** 1807,1818 ****
ui.installUI(this);
}
}
}
! /* Called from the <code>JComponent</code>'s
! * <code>EnableSerializationFocusListener</code> to
* do any Swing-specific pre-serialization configuration.
*/
void compWriteObjectNotify() {
super.compWriteObjectNotify();
// If ToolTipText != null, then the tooltip has already been
--- 1807,1818 ----
ui.installUI(this);
}
}
}
! /* Called from the {@code JComponent}'s
! * {@code EnableSerializationFocusListener} to
* do any Swing-specific pre-serialization configuration.
*/
void compWriteObjectNotify() {
super.compWriteObjectNotify();
// If ToolTipText != null, then the tooltip has already been
*** 1821,1832 ****
ToolTipManager.sharedInstance().unregisterComponent(this);
}
}
/**
! * See <code>readObject</code> and <code>writeObject</code> in
! * <code>JComponent</code> for more
* information about serialization in Swing.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException
{
--- 1821,1832 ----
ToolTipManager.sharedInstance().unregisterComponent(this);
}
}
/**
! * See {@code readObject} and {@code writeObject} in
! * {@code JComponent} for more
* information about serialization in Swing.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException
{
*** 1853,1868 ****
}
}
/**
! * Returns a string representation of this <code>JTabbedPane</code>.
* This method
* is intended to be used only for debugging purposes, and the
* content and format of the returned string may vary between
* implementations. The returned string may be empty but may not
! * be <code>null</code>.
*
* @return a string representation of this JTabbedPane.
*/
protected String paramString() {
String tabPlacementString;
--- 1853,1868 ----
}
}
/**
! * Returns a string representation of this {@code JTabbedPane}.
* This method
* is intended to be used only for debugging purposes, and the
* content and format of the returned string may vary between
* implementations. The returned string may be empty but may not
! * be {@code null}.
*
* @return a string representation of this JTabbedPane.
*/
protected String paramString() {
String tabPlacementString;
*** 1909,1929 ****
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * <code>JTabbedPane</code> class. It provides an implementation of the
* Java Accessibility API appropriate to tabbed pane user-interface
* elements.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class AccessibleJTabbedPane extends AccessibleJComponent
implements AccessibleSelection, ChangeListener {
--- 1909,1929 ----
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * {@code JTabbedPane} class. It provides an implementation of the
* Java Accessibility API appropriate to tabbed pane user-interface
* elements.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class AccessibleJTabbedPane extends AccessibleJComponent
implements AccessibleSelection, ChangeListener {
*** 2001,2028 ****
}
return pages.get(i);
}
/**
! * Gets the <code>AccessibleSelection</code> associated with
* this object. In the implementation of the Java
* Accessibility API for this class,
* returns this object, which is responsible for implementing the
! * <code>AccessibleSelection</code> interface on behalf of itself.
*
* @return this object
*/
public AccessibleSelection getAccessibleSelection() {
return this;
}
/**
! * Returns the <code>Accessible</code> child contained at
! * the local coordinate <code>Point</code>, if one exists.
* Otherwise returns the currently selected tab.
*
! * @return the <code>Accessible</code> at the specified
* location, if it exists
*/
public Accessible getAccessibleAt(Point p) {
int tab = ((TabbedPaneUI) ui).tabForCoordinate(JTabbedPane.this,
p.x, p.y);
--- 2001,2028 ----
}
return pages.get(i);
}
/**
! * Gets the {@code AccessibleSelection} associated with
* this object. In the implementation of the Java
* Accessibility API for this class,
* returns this object, which is responsible for implementing the
! * {@code AccessibleSelection} interface on behalf of itself.
*
* @return this object
*/
public AccessibleSelection getAccessibleSelection() {
return this;
}
/**
! * Returns the {@code Accessible} child contained at
! * the local coordinate {@code Point}, if one exists.
* Otherwise returns the currently selected tab.
*
! * @return the {@code Accessible} at the specified
* location, if it exists
*/
public Accessible getAccessibleAt(Point p) {
int tab = ((TabbedPaneUI) ui).tabForCoordinate(JTabbedPane.this,
p.x, p.y);
*** 2378,2390 ****
}
/**
* Sets the component that is responsible for rendering the
* title for the specified tab. A null value means
! * <code>JTabbedPane</code> will render the title and/or icon for
* the specified tab. A non-null value means the component will
! * render the title and <code>JTabbedPane</code> will not render
* the title and/or icon.
* <p>
* Note: The component must not be one that the developer has
* already added to the tabbed pane.
*
--- 2378,2390 ----
}
/**
* Sets the component that is responsible for rendering the
* title for the specified tab. A null value means
! * {@code JTabbedPane} will render the title and/or icon for
* the specified tab. A non-null value means the component will
! * render the title and {@code JTabbedPane} will not render
* the title and/or icon.
* <p>
* Note: The component must not be one that the developer has
* already added to the tabbed pane.
*
*** 2392,2402 ****
* @param component the component to render the title for the
* specified tab
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
* @exception IllegalArgumentException if component has already been
! * added to this <code>JTabbedPane</code>
*
* @see #getTabComponentAt
* @beaninfo
* preferred: true
* attribute: visualUpdate true
--- 2392,2402 ----
* @param component the component to render the title for the
* specified tab
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
* @exception IllegalArgumentException if component has already been
! * added to this {@code JTabbedPane}
*
* @see #getTabComponentAt
* @beaninfo
* preferred: true
* attribute: visualUpdate true
*** 2417,2430 ****
firePropertyChange("indexForTabComponent", -1, index);
}
}
/**
! * Returns the tab component at <code>index</code>.
*
* @param index the index of the item being queried
! * @return the tab component at <code>index</code>
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setTabComponentAt
* @since 1.6
--- 2417,2430 ----
firePropertyChange("indexForTabComponent", -1, index);
}
}
/**
! * Returns the tab component at {@code index}.
*
* @param index the index of the item being queried
! * @return the tab component at {@code index}
* @exception IndexOutOfBoundsException if index is out of range
* {@code (index < 0 || index >= tab count)}
*
* @see #setTabComponentAt
* @since 1.6
< prev index next >