javax.swing
Class JTabbedPanejava.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JTabbedPane
- All Implemented Interfaces:
- Accessible, ImageObserver, MenuContainer, Serializable, SwingConstants
- public class JTabbedPane
- extends JComponent
- implements Serializable, Accessible, SwingConstants
A component that lets the user switch between a group of components by clicking on a tab with a given title and/or icon. For examples and information on using tabbed panes see How to Use Tabbed Panes, a section in The Java Tutorial.
Tabs/components are added to a TabbedPane object by using the addTab and 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.
The TabbedPane uses a 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.
For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JTabbedPane key assignments.
Warning: 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 JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.
- See Also:
- SingleSelectionModel
Nested Class Summary
protected class JTabbedPane.AccessibleJTabbedPane
This class implements accessibility support for the JTabbedPane class.protected class JTabbedPane.ModelListener
We pass ModelChanged events along to the listeners with the tabbedpane (instead of the model itself) as the event source.
Nested classes inherited from class javax.swing.JComponent
Nested classes inherited from class java.awt.Container
Nested classes inherited from class java.awt.Component Component.BltBufferStrategy, Component.FlipBufferStrategy
Field Summary
protected ChangeEvent changeEvent
Only one ChangeEvent is needed per TabPane instance since the event's only (read-only) state is the source property.protected ChangeListener changeListener
The changeListener is the listener we add to the model.protected SingleSelectionModel model
The default selection modelstatic int SCROLL_TAB_LAYOUT
Tab layout policy for providing a subset of available tabs when all the tabs will not fit within a single run.protected int tabPlacement
Where the tabs are placed.static int WRAP_TAB_LAYOUT
The tab layout policy for wrapping tabs in multiple runs when all tabs will not fit within a single run.
Fields inherited from class javax.swing.JComponent accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface javax.swing.SwingConstants BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH,