Methods Summary |
---|
public java.awt.Component | add(java.awt.Component component)Adds a component with a tab title defaulting to
the name of the component which is the result of calling
component.getName .
Cover method for insertTab .
if (!(component instanceof UIResource)) {
addTab(component.getName(), component);
} else {
super.add(component);
}
return component;
|
public java.awt.Component | add(java.lang.String title, java.awt.Component component)Adds a component with the specified tab title.
Cover method for insertTab .
if (!(component instanceof UIResource)) {
addTab(title, component);
} else {
super.add(title, component);
}
return component;
|
public java.awt.Component | add(java.awt.Component component, int index)Adds a component at the specified tab index with a tab
title defaulting to the name of the component.
Cover method for insertTab .
if (!(component instanceof UIResource)) {
// Container.add() interprets -1 as "append", so convert
// the index appropriately to be handled by the vector
insertTab(component.getName(), null, component, null,
index == -1? getTabCount() : index);
} else {
super.add(component, index);
}
return component;
|
public void | add(java.awt.Component component, java.lang.Object constraints)Adds a component to the tabbed pane.
If constraints is a String or an
Icon , it will be used for the tab title,
otherwise the component's name will be used as the tab title.
Cover method for insertTab .
if (!(component instanceof UIResource)) {
if (constraints instanceof String) {
addTab((String)constraints, component);
} else if (constraints instanceof Icon) {
addTab(null, (Icon)constraints, component);
} else {
add(component);
}
} else {
super.add(component, constraints);
}
|
public void | add(java.awt.Component component, java.lang.Object constraints, int index)Adds a component at the specified tab index.
If constraints is a String or an
Icon , it will be used for the tab title,
otherwise the component's name will be used as the tab title.
Cover method for insertTab .
if (!(component instanceof UIResource)) {
Icon icon = constraints instanceof Icon? (Icon)constraints : null;
String title = constraints instanceof String? (String)constraints : null;
// Container.add() interprets -1 as "append", so convert
// the index appropriately to be handled by the vector
insertTab(title, icon, component, null, index == -1? getTabCount() : index);
} else {
super.add(component, constraints, index);
}
|
public void | addChangeListener(javax.swing.event.ChangeListener l)Adds a ChangeListener to this tabbedpane.
listenerList.add(ChangeListener.class, l);
|
public void | addTab(java.lang.String title, javax.swing.Icon icon, java.awt.Component component, java.lang.String tip)Adds a component and tip
represented by a title and/or icon ,
either of which can be null .
Cover method for insertTab .
insertTab(title, icon, component, tip, pages.size());
|
public void | addTab(java.lang.String title, javax.swing.Icon icon, java.awt.Component component)Adds a component represented by a title
and/or icon , either of which can be null .
Cover method for insertTab .
insertTab(title, icon, component, null, pages.size());
|
public void | addTab(java.lang.String title, java.awt.Component component)Adds a component represented by a title
and no icon.
Cover method for insertTab .
insertTab(title, null, component, null, pages.size());
|
private void | checkIndex(int index)
if (index < 0 || index >= pages.size()) {
throw new IndexOutOfBoundsException("Index: "+index+", Tab count: "+pages.size());
}
|
void | compWriteObjectNotify()
super.compWriteObjectNotify();
// If ToolTipText != null, then the tooltip has already been
// unregistered by JComponent.compWriteObjectNotify()
if (getToolTipText() == null && haveRegistered) {
ToolTipManager.sharedInstance().unregisterComponent(this);
}
|
protected javax.swing.event.ChangeListener | createChangeListener()Subclasses that want to handle ChangeEvents differently
can override this to return a subclass of ModelListener or
another ChangeListener implementation.
return new ModelListener();
|
protected void | fireStateChanged()Sends a ChangeEvent , whose source is this tabbedpane,
to each listener. This method method is called each time
a ChangeEvent is received from the model.
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==ChangeListener.class) {
// Lazily create the event:
if (changeEvent == null)
changeEvent = new ChangeEvent(this);
((ChangeListener)listeners[i+1]).stateChanged(changeEvent);
}
}
|
public javax.accessibility.AccessibleContext | getAccessibleContext()Gets the AccessibleContext associated with this JTabbedPane.
For tabbed panes, the AccessibleContext takes the form of an
AccessibleJTabbedPane.
A new AccessibleJTabbedPane instance is created if necessary.
if (accessibleContext == null) {
accessibleContext = new AccessibleJTabbedPane();
}
return accessibleContext;
|
public java.awt.Color | getBackgroundAt(int index)Returns the tab background color at index .
return ((Page)pages.elementAt(index)).getBackground();
|
public java.awt.Rectangle | getBoundsAt(int index)Returns the tab bounds at index . If the tab at
this index is not currently visible in the UI, then returns
null .
If there is no UI set on this tabbedpane ,
then returns null .
checkIndex(index);
if (ui != null) {
return ((TabbedPaneUI)ui).getTabBounds(this, index);
}
return null;
|
public javax.swing.event.ChangeListener[] | getChangeListeners()Returns an array of all the ChangeListener s added
to this JTabbedPane with addChangeListener .
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
|
public java.awt.Component | getComponentAt(int index)Returns the component at index .
return ((Page)pages.elementAt(index)).component;
|
public javax.swing.Icon | getDisabledIconAt(int index)Returns the tab disabled icon at index .
If the tab disabled icon doesn't exist at 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.
Page page = ((Page)pages.elementAt(index));
if (page.disabledIcon == null) {
page.disabledIcon = UIManager.getLookAndFeel().getDisabledIcon(this, page.icon);
}
return page.disabledIcon;
|
public int | getDisplayedMnemonicIndexAt(int tabIndex)Returns the character, as an index, that the look and feel should
provide decoration for as representing the mnemonic character.
checkIndex(tabIndex);
Page page = (Page)pages.elementAt(tabIndex);
return page.getDisplayedMnemonicIndex();
|
public java.awt.Color | getForegroundAt(int index)Returns the tab foreground color at index .
return ((Page)pages.elementAt(index)).getForeground();
|
public javax.swing.Icon | getIconAt(int index)Returns the tab icon at index .
return ((Page)pages.elementAt(index)).icon;
|
public int | getMnemonicAt(int tabIndex)Returns the keyboard mnemonic for accessing the specified tab.
The mnemonic is the key which when combined with the look and feel's
mouseless modifier (usually Alt) will activate the specified
tab.
checkIndex(tabIndex);
Page page = (Page)pages.elementAt(tabIndex);
return page.getMnemonic();
|
public javax.swing.SingleSelectionModel | getModel()Returns the model associated with this tabbedpane.
return model;
|
public java.awt.Component | getSelectedComponent()Returns the currently selected component for this tabbedpane.
Returns null if there is no currently selected tab.
int index = getSelectedIndex();
if (index == -1) {
return null;
}
return getComponentAt(index);
|
public int | getSelectedIndex()Returns the currently selected index for this tabbedpane.
Returns -1 if there is no currently selected tab.
return model.getSelectedIndex();
|
public int | getTabCount()Returns the number of tabs in this tabbedpane .
return pages.size();
|
public int | getTabLayoutPolicy()Returns the policy used by the tabbedpane to layout the tabs when all the
tabs will not fit within a single run.
return tabLayoutPolicy;
|
public int | getTabPlacement()Returns the placement of the tabs for this tabbedpane.
return tabPlacement;
|
public int | getTabRunCount()Returns the number of tab runs currently used to display
the tabs.
if (ui != null) {
return ((TabbedPaneUI)ui).getTabRunCount(this);
}
return 0;
|
public java.lang.String | getTitleAt(int index)Returns the tab title at index .
return ((Page)pages.elementAt(index)).title;
|
public java.lang.String | getToolTipText(java.awt.event.MouseEvent event)Returns the tooltip text for the component determined by the
mouse event location.
if (ui != null) {
int index = ((TabbedPaneUI)ui).tabForCoordinate(this, event.getX(), event.getY());
if (index != -1) {
return ((Page)pages.elementAt(index)).tip;
}
}
return super.getToolTipText(event);
|
public java.lang.String | getToolTipTextAt(int index)Returns the tab tooltip text at index .
return ((Page)pages.elementAt(index)).tip;
|
public javax.swing.plaf.TabbedPaneUI | getUI()Returns the UI object which implements the L&F for this component.
return (TabbedPaneUI)ui;
|
public java.lang.String | getUIClassID()Returns the name of the UI class that implements the
L&F for this component.
return uiClassID;
|
public int | indexAtLocation(int x, int y)Returns the tab index corresponding to the tab whose bounds
intersect the specified location. Returns -1 if no tab
intersects the location.
if (ui != null) {
return ((TabbedPaneUI)ui).tabForCoordinate(this, x, y);
}
return -1;
|
public int | indexOfComponent(java.awt.Component component)Returns the index of the tab for the specified component.
Returns -1 if there is no tab for this component.
for(int i = 0; i < getTabCount(); i++) {
Component c = getComponentAt(i);
if ((c != null && c.equals(component)) ||
(c == null && c == component)) {
return i;
}
}
return -1;
|
public int | indexOfTab(java.lang.String title)Returns the first tab index with a given title , or
-1 if no tab has this title.
for(int i = 0; i < getTabCount(); i++) {
if (getTitleAt(i).equals(title == null? "" : title)) {
return i;
}
}
return -1;
|
public int | indexOfTab(javax.swing.Icon icon)Returns the first tab index with a given icon ,
or -1 if no tab has this icon.
for(int i = 0; i < getTabCount(); i++) {
Icon tabIcon = getIconAt(i);
if ((tabIcon != null && tabIcon.equals(icon)) ||
(tabIcon == null && tabIcon == icon)) {
return i;
}
}
return -1;
|
public void | insertTab(java.lang.String title, javax.swing.Icon icon, java.awt.Component component, java.lang.String tip, int index)Inserts a component , at index ,
represented by a title and/or icon ,
either of which may be null .
Uses java.util.Vector internally, see insertElementAt
for details of insertion conventions.
int newIndex = index;
// If component already exists, remove corresponding
// tab so that new tab gets added correctly
// Note: we are allowing component=null because of compatibility,
// but we really should throw an exception because much of the
// rest of the JTabbedPane implementation isn't designed to deal
// with null components for tabs.
int removeIndex = indexOfComponent(component);
if (component != null && removeIndex != -1) {
removeTabAt(removeIndex);
if (newIndex > removeIndex) {
newIndex--;
}
}
int selectedIndex = getSelectedIndex();
pages.insertElementAt(new Page(this, title != null? title : "", icon, null,
component, tip), newIndex);
if (component != null) {
addImpl(component, null, -1);
component.setVisible(false);
}
if (pages.size() == 1) {
setSelectedIndex(0);
}
if (selectedIndex >= newIndex) {
setSelectedIndex(selectedIndex + 1);
}
if (!haveRegistered && tip != null) {
ToolTipManager.sharedInstance().registerComponent(this);
haveRegistered = true;
}
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
null, component);
}
revalidate();
repaint();
|
public boolean | isEnabledAt(int index)Returns whether or not the tab at index is
currently enabled.
return ((Page)pages.elementAt(index)).isEnabled();
|
protected java.lang.String | paramString()Returns a string representation of this 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 null .
String tabPlacementString;
if (tabPlacement == TOP) {
tabPlacementString = "TOP";
} else if (tabPlacement == BOTTOM) {
tabPlacementString = "BOTTOM";
} else if (tabPlacement == LEFT) {
tabPlacementString = "LEFT";
} else if (tabPlacement == RIGHT) {
tabPlacementString = "RIGHT";
} else tabPlacementString = "";
String haveRegisteredString = (haveRegistered ?
"true" : "false");
return super.paramString() +
",haveRegistered=" + haveRegisteredString +
",tabPlacement=" + tabPlacementString;
|
private void | readObject(java.io.ObjectInputStream s)See readObject and writeObject in
JComponent for more
information about serialization in Swing.
s.defaultReadObject();
if ((ui != null) && (getUIClassID().equals(uiClassID))) {
ui.installUI(this);
}
// If ToolTipText != null, then the tooltip has already been
// registered by JComponent.readObject()
if (getToolTipText() == null && haveRegistered) {
ToolTipManager.sharedInstance().registerComponent(this);
}
|
public void | remove(java.awt.Component component)Removes the specified Component from the
JTabbedPane . The method does nothing
if the component is null.
int index = indexOfComponent(component);
if (index != -1) {
removeTabAt(index);
} else {
// Container#remove(comp) invokes Container#remove(int)
// so make sure JTabbedPane#remove(int) isn't called here
Component children[] = getComponents();
for (int i=0; i < children.length; i++) {
if (component == children[i]) {
super.remove(i);
break;
}
}
}
|
public void | remove(int index)Removes the tab and component which corresponds to the specified index.
removeTabAt(index);
|
public void | removeAll()Removes all the tabs and their corresponding components
from the tabbedpane .
setSelectedIndexImpl(-1);
int tabCount = getTabCount();
// We invoke removeTabAt for each tab, otherwise we may end up
// removing Components added by the UI.
while (tabCount-- > 0) {
removeTabAt(tabCount);
}
|
public void | removeChangeListener(javax.swing.event.ChangeListener l)Removes a ChangeListener from this tabbedpane.
listenerList.remove(ChangeListener.class, l);
|
public void | removeTabAt(int index)Removes the tab at index .
After the component associated with index is removed,
its visibility is reset to true to ensure it will be visible
if added to other containers.
checkIndex(index);
// If we are removing the currently selected tab AND
// it happens to be the last tab in the bunch, then
// select the previous tab
int tabCount = getTabCount();
int selected = getSelectedIndex();
if (selected >= (tabCount - 1)) {
setSelectedIndexImpl(selected - 1);
}
Component component = getComponentAt(index);
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
component, null);
}
pages.removeElementAt(index);
// NOTE 4/15/2002 (joutwate):
// This fix is implemented using client properties since there is
// currently no IndexPropertyChangeEvent. Once
// IndexPropertyChangeEvents have been added this code should be
// modified to use it.
putClientProperty("__index_to_remove__", new Integer(index));
// We can't assume the tab indices correspond to the
// container's children array indices, so make sure we
// remove the correct child!
if (component != null) {
Component components[] = getComponents();
for (int i = components.length; --i >= 0; ) {
if (components[i] == component) {
super.remove(i);
component.setVisible(true);
break;
}
}
}
revalidate();
repaint();
|
public void | setBackgroundAt(int index, java.awt.Color background)Sets the background color at index to
background
which can be null , in which case the tab's background color
will default to the background color of the tabbedpane .
An internal exception is raised if there is no tab at that index.
Color oldBg = ((Page)pages.elementAt(index)).background;
((Page)pages.elementAt(index)).setBackground(background);
if (background == null || oldBg == null ||
!background.equals(oldBg)) {
Rectangle tabBounds = getBoundsAt(index);
if (tabBounds != null) {
repaint(tabBounds);
}
}
|
public void | setComponentAt(int index, java.awt.Component component)Sets the component at index to component .
An internal exception is raised if there is no tab at that index.
Page page = (Page)pages.elementAt(index);
if (component != page.component) {
if (page.component != null) {
// REMIND(aim): this is really silly;
// why not if (page.component.getParent() == this) remove(component)
synchronized(getTreeLock()) {
int count = getComponentCount();
Component children[] = getComponents();
for (int i = 0; i < count; i++) {
if (children[i] == page.component) {
super.remove(i);
}
}
}
}
page.component = component;
component.setVisible(getSelectedIndex() == index);
addImpl(component, null, -1);
revalidate();
}
|
public void | setDisabledIconAt(int index, javax.swing.Icon disabledIcon)Sets the disabled icon at index to icon
which can be null .
An internal exception is raised if there is no tab at that index.
Icon oldIcon = ((Page)pages.elementAt(index)).disabledIcon;
((Page)pages.elementAt(index)).disabledIcon = disabledIcon;
if (disabledIcon != oldIcon && !isEnabledAt(index)) {
revalidate();
repaint();
}
|
public void | setDisplayedMnemonicIndexAt(int tabIndex, int mnemonicIndex)Provides a hint to the look and feel as to which character in the
text should be decorated to represent the mnemonic. Not all look and
feels may support this. A value of -1 indicates either there is
no mnemonic for this tab, or you do not wish the mnemonic to be
displayed for this tab.
The value of this is updated as the properties relating to the
mnemonic change (such as the mnemonic itself, the text...).
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 Price', you would have to invoke
setDisplayedMnemonicIndex(3, 6) after invoking
setMnemonicAt(3, KeyEvent.VK_P) .
Note that it is the programmer's responsibility to ensure
that each tab has a unique mnemonic or unpredictable results may
occur.
checkIndex(tabIndex);
Page page = (Page)pages.elementAt(tabIndex);
page.setDisplayedMnemonicIndex(mnemonicIndex);
|
public void | setEnabledAt(int index, boolean enabled)Sets whether or not the tab at index is enabled.
An internal exception is raised if there is no tab at that index.
boolean oldEnabled = ((Page)pages.elementAt(index)).isEnabled();
((Page)pages.elementAt(index)).setEnabled(enabled);
if (enabled != oldEnabled) {
revalidate();
repaint();
}
|
public void | setForegroundAt(int index, java.awt.Color foreground)Sets the foreground color at index to
foreground which can be
null , in which case the tab's foreground color
will default to the foreground color of this tabbedpane .
An internal exception is raised if there is no tab at that index.
Color oldFg = ((Page)pages.elementAt(index)).foreground;
((Page)pages.elementAt(index)).setForeground(foreground);
if (foreground == null || oldFg == null ||
!foreground.equals(oldFg)) {
Rectangle tabBounds = getBoundsAt(index);
if (tabBounds != null) {
repaint(tabBounds);
}
}
|
public void | setIconAt(int index, javax.swing.Icon icon)Sets the icon at index to icon which can be
null . This does not set disabled icon at 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 setDisableIconAt() .
An internal exception is raised if there is no tab at that index.
Page page = (Page)pages.elementAt(index);
Icon oldIcon = page.icon;
if (icon != oldIcon) {
page.icon = icon;
/* If the default icon has really changed and we had
* generated the disabled icon for this page, then
* clear the disabledIcon field of the page.
*/
if (page.disabledIcon instanceof UIResource) {
page.disabledIcon = null;
}
// Fire the accessibility Visible data change
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
oldIcon, icon);
}
revalidate();
repaint();
}
|
public void | setMnemonicAt(int tabIndex, int mnemonic)Sets the keyboard mnemonic for accessing the specified tab.
The mnemonic is the key which when combined with the look and feel's
mouseless modifier (usually Alt) will activate the specified
tab.
A mnemonic must correspond to a single key on the keyboard
and should be specified using one of the VK_XXX
keycodes defined in java.awt.event.KeyEvent .
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.
This will update the displayed mnemonic property for the specified
tab.
checkIndex(tabIndex);
Page page = (Page)pages.elementAt(tabIndex);
page.setMnemonic(mnemonic);
firePropertyChange("mnemonicAt", null, null);
|
public void | setModel(javax.swing.SingleSelectionModel model)Sets the model to be used with this tabbedpane.
SingleSelectionModel oldModel = getModel();
if (oldModel != null) {
oldModel.removeChangeListener(changeListener);
changeListener = null;
}
this.model = model;
if (model != null) {
changeListener = createChangeListener();
model.addChangeListener(changeListener);
}
firePropertyChange("model", oldModel, model);
repaint();
|
public void | setSelectedComponent(java.awt.Component c)Sets the selected component for this tabbedpane. This
will automatically set the selectedIndex to the index
corresponding to the specified component.
int index = indexOfComponent(c);
if (index != -1) {
setSelectedIndex(index);
} else {
throw new IllegalArgumentException("component not found in tabbed pane");
}
|
public void | setSelectedIndex(int index)Sets the selected index for this tabbedpane. The index must be
a valid tab index or -1, which indicates that no tab should be selected
(can also be used when there are no tabs in the tabbedpane). If a -1
value is specified when the tabbedpane contains one or more tabs, then
the results will be implementation defined.
if (index != -1) {
checkIndex(index);
}
setSelectedIndexImpl(index);
|
private void | setSelectedIndexImpl(int index)
int oldIndex = model.getSelectedIndex();
Page oldPage = null, newPage = null;
if ((oldIndex >= 0) && (oldIndex != index)) {
oldPage = (Page) pages.elementAt(oldIndex);
}
if ((index >= 0) && (oldIndex != index)) {
newPage = (Page) pages.elementAt(index);
}
model.setSelectedIndex(index);
String oldName = null;
String newName = null;
if (oldPage != null) {
oldPage.firePropertyChange(
AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
AccessibleState.SELECTED, null);
// TIGER - 4840667
AccessibleContext ac = oldPage.getAccessibleContext();
if (ac != null) {
oldName = ac.getAccessibleName();
}
}
if (newPage != null) {
newPage.firePropertyChange(
AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
null, AccessibleState.SELECTED);
// TIGER - 4840667
AccessibleContext ac = newPage.getAccessibleContext();
if (ac != null) {
newName = ac.getAccessibleName();
}
}
// TIGER - 4840667
if (newName != null) {
getAccessibleContext().firePropertyChange(
AccessibleContext.ACCESSIBLE_NAME_PROPERTY, oldName, newName);
}
|
public void | setTabLayoutPolicy(int tabLayoutPolicy)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:
JTabbedPane.WRAP_TAB_LAYOUT
JTabbedPane.SCROLL_TAB_LAYOUT
The default value, if not set by the UI, is JTabbedPane.WRAP_TAB_LAYOUT .
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.
if (tabLayoutPolicy != WRAP_TAB_LAYOUT && tabLayoutPolicy != SCROLL_TAB_LAYOUT) {
throw new IllegalArgumentException("illegal tab layout policy: must be WRAP_TAB_LAYOUT or SCROLL_TAB_LAYOUT");
}
if (this.tabLayoutPolicy != tabLayoutPolicy) {
int oldValue = this.tabLayoutPolicy;
this.tabLayoutPolicy = tabLayoutPolicy;
firePropertyChange("tabLayoutPolicy", oldValue, tabLayoutPolicy);
revalidate();
repaint();
}
|
public void | setTabPlacement(int tabPlacement)Sets the tab placement for this tabbedpane.
Possible values are:
JTabbedPane.TOP
JTabbedPane.BOTTOM
JTabbedPane.LEFT
JTabbedPane.RIGHT
The default value, if not set, is SwingConstants.TOP .
if (tabPlacement != TOP && tabPlacement != LEFT &&
tabPlacement != BOTTOM && tabPlacement != RIGHT) {
throw new IllegalArgumentException("illegal tab placement: must be TOP, BOTTOM, LEFT, or RIGHT");
}
if (this.tabPlacement != tabPlacement) {
int oldValue = this.tabPlacement;
this.tabPlacement = tabPlacement;
firePropertyChange("tabPlacement", oldValue, tabPlacement);
revalidate();
repaint();
}
|
public void | setTitleAt(int index, java.lang.String title)Sets the title at index to title which
can be null .
An internal exception is raised if there is no tab at that index.
Page page = (Page)pages.elementAt(index);
String oldTitle =page.title;
page.title = title;
if (oldTitle != title) {
firePropertyChange("indexForTitle", -1, index);
}
page.updateDisplayedMnemonicIndex();
if ((oldTitle != title) && (accessibleContext != null)) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
oldTitle, title);
}
if (title == null || oldTitle == null ||
!title.equals(oldTitle)) {
revalidate();
repaint();
}
|
public void | setToolTipTextAt(int index, java.lang.String toolTipText)Sets the tooltip text at index to toolTipText
which can be null .
An internal exception is raised if there is no tab at that index.
String oldToolTipText =((Page)pages.elementAt(index)).tip;
((Page)pages.elementAt(index)).tip = toolTipText;
if ((oldToolTipText != toolTipText) && (accessibleContext != null)) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
oldToolTipText, toolTipText);
}
if (!haveRegistered && toolTipText != null) {
ToolTipManager.sharedInstance().registerComponent(this);
haveRegistered = true;
}
|
public void | setUI(javax.swing.plaf.TabbedPaneUI ui)Sets the UI object which implements the L&F for this component.
super.setUI(ui);
// disabled icons are generated by LF so they should be unset here
for (int i = 0; i < getTabCount(); i++) {
Icon icon = ((Page)pages.elementAt(i)).disabledIcon;
if (icon instanceof UIResource) {
setDisabledIconAt(i, null);
}
}
|
public void | updateUI()Resets the UI property to a value from the current look and feel.
setUI((TabbedPaneUI)UIManager.getUI(this));
|
private void | writeObject(java.io.ObjectOutputStream s)See readObject and writeObject in
JComponent for more
information about serialization in Swing.
s.defaultWriteObject();
if (getUIClassID().equals(uiClassID)) {
byte count = JComponent.getWriteObjCounter(this);
JComponent.setWriteObjCounter(this, --count);
if (count == 0 && ui != null) {
ui.installUI(this);
}
}
|