Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTabbedPane
Nested Class Summary | |
protected class |
|
protected class |
|
Nested classes/interfaces inherited from class javax.swing.JComponent | |
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container | |
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent , Component.BltBufferStrategy , Component.FlipBufferStrategy |
Field Summary | |
static int |
|
static int |
|
protected ChangeEvent |
|
protected ChangeListener |
|
protected SingleSelectionModel |
|
protected int |
|
Fields inherited from class javax.swing.JComponent | |
TOOL_TIP_TEXT_KEY , UNDEFINED_CONDITION , WHEN_ANCESTOR_OF_FOCUSED_COMPONENT , WHEN_FOCUSED , WHEN_IN_FOCUSED_WINDOW , accessibleContext , listenerList , ui |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH |
Fields inherited from interface javax.swing.SwingConstants | |
BOTTOM , CENTER , EAST , HORIZONTAL , LEADING , LEFT , NEXT , NORTH , NORTH_EAST , NORTH_WEST , PREVIOUS , RIGHT , SOUTH , SOUTH_EAST , SOUTH_WEST , TOP , TRAILING , VERTICAL , WEST |
Constructor Summary | |
| |
| |
|
Method Summary | |
Component | |
Component | |
void | |
void | |
Component | |
void |
|
void | |
void | |
void | |
protected ChangeListener |
|
protected void |
|
AccessibleContext |
|
Color |
|
Rectangle |
|
ChangeListener[] |
|
Component |
|
Icon |
|
int |
|
Color |
|
Icon |
|
int |
|
SingleSelectionModel |
|
Component |
|
int |
|
int |
|
int |
|
int |
|
int |
|
String |
|
String |
|
String |
|
TabbedPaneUI |
|
String |
|
int |
|
int |
|
int |
|
int |
|
void | |
boolean |
|
protected String |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final int SCROLL_TAB_LAYOUT
Indicates that the TabbedPane is in scrolling mode.
- Field Value:
- 1
public static final int WRAP_TAB_LAYOUT
Indicates that the TabbedPane is in wrap mode.
- Field Value:
- 0
public JTabbedPane()
Creates a new JTabbedPane object with tabs on top and using wrap tab layout.
public JTabbedPane(int tabPlacement)
Creates a new JTabbedPane object using wrap tab layout and the giventabPlacement
, wheretabPlacement
can be one of the following values:SwingConstants.TOP
,SwingConstants.BOTTOM
,SwingConstants.LEFT
orSwingConstants.RIGHT
.
- Parameters:
tabPlacement
- where the tabs will be placed
public JTabbedPane(int tabPlacement, int tabLayoutPolicy)
Creates a new JTabbedPane object with the giventabPlacement
andtabLayoutPolicy
. ThetabPlacement
can be one of the following values:SwingConstants.TOP
,SwingConstants.BOTTOM
,SwingConstants.LEFT
orSwingConstants.RIGHT
. ThetabLayoutPolicy
can be eitherSCROLL_TAB_LAYOUT
orWRAP_TAB_LAYOUT
.
- Parameters:
tabPlacement
- where the tabs will be placedtabLayoutPolicy
- the way tabs will be placed
- Throws:
IllegalArgumentException
- If tabLayoutPolicy or tabPlacement are not valid.
public Component add(Component component)
This method adds a tab to the JTabbedPane. The title of the tab is the Component's name. If the Component is an instance of UIResource, it doesn't add the tab and instead add the component directly to the JTabbedPane.
- Parameters:
component
- The associated component.
- Returns:
- The Component that was added.
public Component add(Component component, int index)
This method adds a tab to the JTabbedPane. If the Component is an instance of UIResource, it doesn't add the tab and instead add the component directly to the JTabbedPane.
- Parameters:
component
- The associated component.index
- The index to insert the tab at.
- Returns:
- The Component that was added.
public void add(Component component, Object constraints)
This method adds a tab to the JTabbedPane. If the Component is an instance of UIResource, it doesn't add the tab and instead add the component directly to the JTabbedPane. If the constraints object is an icon, it will be used as the tab's icon. If the constraints object is a string, we will use it as the title.
- Parameters:
component
- The associated component.constraints
- The constraints object.
public void add(Component component, Object constraints, int index)
This method adds a tab to the JTabbedPane. If the Component is an instance of UIResource, it doesn't add the tab and instead add the component directly to the JTabbedPane. If the constraints object is an icon, it will be used as the tab's icon. If the constraints object is a string, we will use it as the title.
- Parameters:
component
- The associated component.constraints
- The constraints object.index
- The index to insert the tab at.
public Component add(String title, Component component)
This method adds a tab to the JTabbedPane. If the Component is an instance of UIResource, it doesn't add the tab and instead add the component directly to the JTabbedPane.
- Parameters:
title
- the title of the tab; may benull
component
- the associated component
- Returns:
- The Component that was added.
public void addChangeListener(ChangeListener l)
This method adds a ChangeListener to the JTabbedPane.
- Parameters:
l
- The ChangeListener to add.
public void addTab(String title, Component component)
This method adds a tab to the JTabbedPane.
- Parameters:
title
- the title of the tab; may benull
component
- the associated component
public void addTab(String title, Icon icon, Component component)
This method adds a tab to the JTabbedPane.
- Parameters:
title
- the title of the tab; may benull
icon
- the icon for the tab; may benull
component
- the associated component
public void addTab(String title, Icon icon, Component component, String tip)
This method adds a tab to the JTabbedPane.
- Parameters:
title
- the title of the tab; may benull
icon
- the icon for the tab; may benull
component
- the associated componenttip
- the associated tooltip
protected ChangeListener createChangeListener()
This method creates a ChangeListener that is used to listen to the model for events.
- Returns:
- A ChangeListener to listen to the model.
protected void fireStateChanged()
This method fires a ChangeEvent to all the JTabbedPane's ChangeListeners.
public AccessibleContext getAccessibleContext()
Returns the object that provides accessibility features for thisJTabbedPane
component.
- Specified by:
- getAccessibleContext in interface Accessible
- Overrides:
- getAccessibleContext in interface JComponent
- Returns:
- The accessible context (an instance of
JTabbedPane.AccessibleJTabbedPane
).
public Color getBackgroundAt(int index)
This method returns the background color for the tab.
- Parameters:
index
- The index of the tab.
- Returns:
- The background color for the tab.
public Rectangle getBoundsAt(int index)
This method returns the bounds of the tab given the index.
- Parameters:
index
- The index of the tab.
- Returns:
- A rectangle describing the bounds of the tab.
public ChangeListener[] getChangeListeners()
This method returns all ChangeListeners registered with the JTabbedPane.
- Returns:
- The ChangeListeners registered with the JTabbedPane.
public Component getComponentAt(int index)
This method returns the component associated with the tab.
- Parameters:
index
- The index of the tab.
- Returns:
- The component associated with the tab.
public Icon getDisabledIconAt(int index)
This method returns the disabled icon given the index.
- Parameters:
index
- The index of the tab.
- Returns:
- The disabled icon for the tab.
public int getDisplayedMnemonicIndexAt(int tabIndex)
This method returns the mnemonic index for the tab.
- Parameters:
tabIndex
- The index of the tab.
- Returns:
- The mnemonic index for the tab.
public Color getForegroundAt(int index)
This method returns the foreground color for the tab.
- Parameters:
index
- The index of the tab.
- Returns:
- The foreground color for the tab.
public Icon getIconAt(int index)
This method returns the active icon given the index.
- Parameters:
index
- The index of the tab.
- Returns:
- The active icon for the tab.
public int getMnemonicAt(int tabIndex)
This method returns the mnemonic for the tab.
- Parameters:
tabIndex
- The index of the tab.
- Returns:
- The mnemonic for the tab.
public SingleSelectionModel getModel()
This method returns the model used with the JTabbedPane.
- Returns:
- The JTabbedPane's model.
public Component getSelectedComponent()
This method returns the component at the selected index.
- Returns:
- The component at the selected index.
public int getSelectedIndex()
This method returns the index of the tab that is currently selected.
- Returns:
- The index of the selected tab.
public int getTabCount()
This method returns how many tabs are in the JTabbedPane.
- Returns:
- The number of tabs in the JTabbedPane.
public int getTabLayoutPolicy()
This method returns the tabLayoutPolicy.
- Returns:
- The tabLayoutPolicy.
public int getTabPlacement()
This method returns the tabPlacement.
- Returns:
- The tabPlacement used with the JTabbedPane.
public int getTabRunCount()
This method returns the number of runs used to paint the JTabbedPane.
- Returns:
- The number of runs.
public String getTitleAt(int index)
This method returns the tab title given the index.
- Parameters:
index
- The index of the tab.
- Returns:
- The title for the tab.
public String getToolTipText(MouseEvent event)
This method returns the tooltip text given a mouse event.
- Overrides:
- getToolTipText in interface JComponent
- Parameters:
event
- The mouse event.
- Returns:
- The tool tip text that is associated with this mouse event.
public String getToolTipTextAt(int index)
This method returns the tooltip string for the tab.
- Parameters:
index
- The index of the tab.
- Returns:
- The tooltip string for the tab.
public TabbedPaneUI getUI()
This method returns the UI used to display the JTabbedPane.
- Returns:
- The UI used to display the JTabbedPane.
public String getUIClassID()
This method returns a string identifier that is used to determine which UI will be used with the JTabbedPane.
- Overrides:
- getUIClassID in interface JComponent
- Returns:
- A string identifier for the UI.
public int indexAtLocation(int x, int y)
This method returns a tab index given an (x,y) location. The origin of the (x,y) pair will be the JTabbedPane's top left position. The tab returned will be the one that contains the point. This method is delegated to the UI.
- Parameters:
x
- The x coordinate of the point.y
- The y coordinate of the point.
- Returns:
- The index of the tab that contains the point.
public int indexOfComponent(Component component)
This method finds the index of a tab given the component.
- Parameters:
component
- A component associated with a tab.
- Returns:
- The index of the tab that has this component or -1 if not found.
public int indexOfTab(String title)
This method finds the index of a tab given the title.
- Parameters:
title
- The title that belongs to a tab.
- Returns:
- The index of the tab that has the title or -1 if not found.
public int indexOfTab(Icon icon)
This method finds the index of a tab given the icon.
- Parameters:
icon
- The icon that belongs to a tab.
- Returns:
- The index of the tab that has the icon or -1 if not found.
public void insertTab(String title, Icon icon, Component component, String tip, int index)
This method inserts tabs into JTabbedPane. This includes adding the component to the JTabbedPane and hiding it.
- Parameters:
title
- the title of the tab; may benull
icon
- the tab's icon; may benull
component
- the component associated with the tabtip
- the tooltip for the tabindex
- the index to insert the tab at
public boolean isEnabledAt(int index)
This method returns whether this tab is enabled. Disabled tabs cannot be selected.
- Parameters:
index
- The index of the tab.
- Returns:
- Whether the tab is enabled.
protected String paramString()
Returns a string describing the attributes for theJTabbedPane
component, for use in debugging. The return value is guaranteed to be non-null
, but the format of the string may vary between implementations.
- Overrides:
- paramString in interface JComponent
- Returns:
- A string describing the attributes of the
JTabbedPane
.
public void remove(int index)
Removes the tab and component which corresponds to the specified index.
- Parameters:
index
- The index of the tab to remove.
public void remove(Component component)
Removes the specified Component from the JTabbedPane.
- Parameters:
component
- The Component to remove.
public void removeAll()
This method removes all tabs and associated components from the JTabbedPane.
public void removeChangeListener(ChangeListener l)
This method removes a ChangeListener to the JTabbedPane.
- Parameters:
l
- The ChangeListener to remove.
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.
- Parameters:
index
- The index of the tab to remove.
public void setBackgroundAt(int index, Color background)
This method sets the background color of the tab.
- Parameters:
index
- The index of the tab.background
- The background color of the tab.
public void setComponentAt(int index, Component component)
This method sets the component associated with the tab.
- Parameters:
index
- The index of the tab.component
- The component associated with the tab.
public void setDisabledIconAt(int index, Icon disabledIcon)
This method sets the disabled icon of the tab.
- Parameters:
index
- The index of the tab.disabledIcon
- The new disabled icon.
public void setDisplayedMnemonicIndexAt(int tabIndex, int mnemonicIndex)
This method sets the displayed mnemonic index of the tab.
- Parameters:
tabIndex
- The index of the tab.mnemonicIndex
- The mnemonic index.
public void setEnabledAt(int index, boolean enabled)
This method sets whether the tab is enabled.
- Parameters:
index
- The index of the tab.enabled
- Whether the tab is enabled.
public void setForegroundAt(int index, Color foreground)
This method sets the foreground color of the tab.
- Parameters:
index
- The index of the tab.foreground
- The foreground color of the tab.
public void setIconAt(int index, Icon icon)
This method sets the icon of the tab.
- Parameters:
index
- The index of the tab.icon
- The new icon.
public void setMnemonicAt(int tabIndex, int mnemonic)
This method sets the mnemonic for the tab.
- Parameters:
tabIndex
- The index of the tab.mnemonic
- The mnemonic.
public void setModel(SingleSelectionModel m)
This method changes the model property of the JTabbedPane.
- Parameters:
m
- The new model to use with the JTabbedPane.
public void setSelectedComponent(Component c)
This method sets the component at the selected index.
- Parameters:
c
- The component associated with the selected index.
public void setSelectedIndex(int index)
This method sets the selected index. This method will hide the old component and show the new component.
- Parameters:
index
- The index to set it at.
public void setTabLayoutPolicy(int tabLayoutPolicy)
This method changes the tabLayoutPolicy property of the JTabbedPane.
- Parameters:
tabLayoutPolicy
- The tabLayoutPolicy to use.
- Throws:
IllegalArgumentException
- If tabLayoutPolicy is not one of SCROLL_TAB_LAYOUT or WRAP_TAB_LAYOUT.
public void setTabPlacement(int tabPlacement)
This method changes the tabPlacement property of the JTabbedPane.
- Parameters:
tabPlacement
- The tabPlacement to use.
- Throws:
IllegalArgumentException
- If tabPlacement is not one of TOP, BOTTOM, LEFT, or RIGHT.
public void setTitleAt(int index, String title)
This method sets the title of the tab.
- Parameters:
index
- The index of the tab.title
- The new title.
public void setToolTipTextAt(int index, String toolTipText)
This method sets the tooltip text of the tab.
- Parameters:
index
- The index of the tab.toolTipText
- The tooltip text.
public void setUI(TabbedPaneUI ui)
This method sets the UI used to display the JTabbedPane.
- Parameters:
ui
- The UI used to display the JTabbedPane.
public void updateUI()
This method restores the UI to the defaults given by the UIManager.
- Overrides:
- updateUI in interface JComponent