Professional Documents
Culture Documents
With the JTabbedPane(in the API reference documentation) class, you can have
several components (usually panels) share the same space. The user chooses which
component to view by selecting the tab corresponding to the desired component. If
you want similar functionality without the tab interface, you might want to use a
card layout(in the Creating a User Interface trail) instead of a tabbed pane.
Here is a picture of an application that has a tabbed pane with four tabs:
A screenshot of TabbedPaneDemo
[PENDING: Cursor should appear just above the top left edge of the tool tip.]
Try this:
As the TabbedPaneDemo example shows, a tab can have a tool tip, and it can
display both text and an image. The example shows the tabs in their default
position, at the top of the tabbed pane. You can change the tab position to be at
the left, right, or bottom of the tabbed pane.
Below is the code from TabbedPaneDemo.java that creates the tabbed pane in the
previous example. Note that no event-handling code is necessary. The JTabbedPane
object takes care of mouse events for you.
This table lists examples that use JTabbedPane and where those examples
are described.