All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.swing.JTabbedPane
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.swing.JComponent
|
+----java.awt.swing.JTabbedPane
- public class JTabbedPane
- extends JComponent
- implements Accessible, Serializable
A control that lets the user switch between a group of components by
clicking on a title.
JTabbedPane.ModelListener- We pass ModelChanged events along to the listeners with the
the TabbedPane (instead of the model itself) as the event source.
changeEvent- Only one ChangeEvent is needed per TabPane instance since the
event's only (read-only) state is the source property.
changeListener- The changeListener is the listener we add to the
model.
model-
JTabbedPane()
- Creates an empty TabbedPane.
addAccessibleSelection(int)
- Selects the given tab.
addChangeListener(ChangeListener)
- Adds a ChangeListener to the button.
addTab(String, Component)
- Adds a component represented by a title and no icon.
addTab(String, Icon, Component)
- Adds a component represented by a title and/or icon,
either of which can be null.
addTab(String, Icon, Component, String)
- Adds a component and tip represented by a title
and/or icon, either of which can be null.
createChangeListener()
- Subclasses that want to handle ChangeEvents differently
can override this to return a subclass of ModelListener or
another ChangeListener implementation.
fireStateChanged()
-
getAccessibleAt(Point)
- Returns the Accessible child contained at the local coordinate
Point, if one exists.
getAccessibleChild(int)
- Return the nth Accessible child of the object.
getAccessibleChildrenCount()
- Returns the number of accessible children in the object.
getAccessibleRole()
- Get the role of this object.
getAccessibleSelection(int)
- Returns an Accessible representing the nth selected item
in the object.
getAccessibleSelectionCount()
- Returns the number of items currently selected.
getComponentAt(int)
- Returns the component at index.
getIconAt(int)
- Returns the icon at index.
getModel()
- Returns the model associated with the TabbedPane.
getSelectedComponent()
-
getSelectedIndex()
- All of the Model methods are implemented by delegation.
getTabCount()
- Returns the number of tabs.
getTitleAt(int)
- Returns the title at index.
getToolTipText(MouseEvent)
- Returns the string to be used as the tooltip for event.
getUI()
- Returns the TabbedPane's UI controller.
getUIClassID()
-
indexOfComponent(Component)
- Returns the index of the tab for the specified component.
indexOfTab(String)
- Convenience method for locating the first tab with a given title,
testing for equality with String.equals.
insertTab(String, Icon, Component, String, int)
- Inserts a component, at index, represented by a
title and/or icon, either of which may be null.
removeChangeListener(ChangeListener)
- Removes a ChangeListener from the button.
removeTabAt(int)
- Removes the tab at index.
setComponentAt(int, Component)
- Sets the component at index to component.
setIconAt(int, Icon)
- Sets the icon at index to icon which can be null.
setModel(SingleSelectionModel)
- Sets the model to be used with the TabbedPane.
setSelectedComponent(Component)
-
setSelectedIndex(int)
-
setTitleAt(int, String)
- Sets the title at index to title which can be null.
setUI(TabbedPaneUI)
- Sets the TabbedPane's UI controller.
updateUI()
- Notification from the UIFactory that the L&F
has changed.
model
protected SingleSelectionModel model
changeListener
protected ChangeListener changeListener
- The changeListener is the listener we add to the
model.
changeEvent
protected transient ChangeEvent changeEvent
- Only one ChangeEvent is needed per TabPane instance since the
event's only (read-only) state is the source property. The source
of events generated here is always "this".
JTabbedPane
public JTabbedPane()
- Creates an empty TabbedPane.
- See Also:
- addTab
getUI
public TabbedPaneUI getUI()
- Returns the TabbedPane's UI controller.
- See Also:
- setUI
setUI
public void setUI(TabbedPaneUI ui)
- Sets the TabbedPane's UI controller.
- Parameters:
- ui - the new UI object
- See Also:
- getUI
updateUI
public void updateUI()
- Notification from the UIFactory that the L&F
has changed.
- Overrides:
- updateUI in class JComponent
getUIClassID
public String getUIClassID()
- Returns:
- "TabbedPaneUI"
- Overrides:
- getUIClassID in class JComponent
- See Also:
- getUIClassID, getUI
createChangeListener
protected ChangeListener createChangeListener()
- Subclasses that want to handle ChangeEvents differently
can override this to return a subclass of ModelListener or
another ChangeListener implementation.
addChangeListener
public void addChangeListener(ChangeListener l)
- Adds a ChangeListener to the button.
removeChangeListener
public void removeChangeListener(ChangeListener l)
- Removes a ChangeListener from the button.
fireStateChanged
protected void fireStateChanged()
getModel
public SingleSelectionModel getModel()
- Returns the model associated with the TabbedPane.
- See Also:
- setModel
setModel
public void setModel(SingleSelectionModel model)
- Sets the model to be used with the TabbedPane.
- Parameters:
- model - the model to be used
- See Also:
- getModel
getSelectedIndex
public int getSelectedIndex()
- All of the Model methods are implemented by delegation.
setSelectedIndex
public void setSelectedIndex(int index)
getSelectedComponent
public Component getSelectedComponent()
setSelectedComponent
public void setSelectedComponent(Component c)
insertTab
public void insertTab(String title,
Icon icon,
Component component,
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.
- Parameters:
- component - The component to be displayed when this tab is clicked.
addTab
public void addTab(String title,
Icon icon,
Component component,
String tip)
- Adds a component and tip represented by a title
and/or icon, either of which can be null.
Cover method for insertTab().
- See Also:
- insertTab
addTab
public void addTab(String title,
Icon icon,
Component component)
- Adds a component represented by a title and/or icon,
either of which can be null.
Cover method for insertTab().
- See Also:
- insertTab
addTab
public void addTab(String title,
Component component)
- Adds a component represented by a title and no icon.
Cover method for insertTab().
- See Also:
- insertTab
removeTabAt
public void removeTabAt(int index)
- Removes the tab at index.
getTabCount
public int getTabCount()
- Returns the number of tabs.
getTitleAt
public String getTitleAt(int index)
- Returns the title at index.
getIconAt
public Icon getIconAt(int index)
- Returns the icon at index.
getComponentAt
public Component getComponentAt(int index)
- Returns the component at index.
setTitleAt
public void setTitleAt(int index,
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.
setIconAt
public void setIconAt(int index,
Icon icon)
- Sets the icon at index to icon which can be null.
An internal exception is raised if there is no tab at that index.
setComponentAt
public void setComponentAt(int index,
Component component)
- Sets the component at index to component.
An internal exception is raised if there is no tab at that index.
indexOfTab
public int indexOfTab(String title)
- Convenience method for locating the first tab with a given title,
testing for equality with String.equals. Returns -1 if no tab has this title.
indexOfComponent
public int indexOfComponent(Component component)
- Returns the index of the tab for the specified component.
Returns -1 if there is no tab for this component.
- Parameters:
- component - the component in the tabbed-pane
getToolTipText
public String getToolTipText(MouseEvent event)
- Returns the string to be used as the tooltip for event.
- Overrides:
- getToolTipText in class JComponent
getAccessibleRole
public AccessibleRole getAccessibleRole()
- Get the role of this object.
- Returns:
- an instance of AccessibleRole describing the role of the object
- Overrides:
- getAccessibleRole in class JComponent
- See Also:
- AccessibleRole
getAccessibleChildrenCount
public int getAccessibleChildrenCount()
- Returns the number of accessible children in the object.
- Returns:
- the number of accessible children in the object.
- Overrides:
- getAccessibleChildrenCount in class JComponent
getAccessibleChild
public Accessible getAccessibleChild(int i)
- Return the nth Accessible child of the object.
- Parameters:
- i - zero-based index of child
- Returns:
- the nth Accessible child of the object
- Overrides:
- getAccessibleChild in class JComponent
getAccessibleSelectionCount
public int getAccessibleSelectionCount()
- Returns the number of items currently selected. This will always be 1.
- Returns:
- the number of items currently selected.
- Overrides:
- getAccessibleSelectionCount in class JComponent
getAccessibleSelection
public Accessible getAccessibleSelection(int i)
- Returns an Accessible representing the nth selected item
in the object. This will always be the current Page that
is selected.
- Parameters:
- i - the zero-based index of selected items
- Returns:
- an Accessible containing the selected item
- Overrides:
- getAccessibleSelection in class JComponent
addAccessibleSelection
public void addAccessibleSelection(int i)
- Selects the given tab.
- Parameters:
- i - the zero-based index of selectable items
- Overrides:
- addAccessibleSelection in class JComponent
getAccessibleAt
public Accessible getAccessibleAt(Point p)
- Returns the Accessible child contained at the local coordinate
Point, if one exists.
- Returns:
- the Accessible at the specified location, if it exists
- Overrides:
- getAccessibleAt in class JComponent
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature