![]() |
VOOZH | about |
JTabbedPane is a GUI(Graphical User Interface) component in the Java Swing library that allows you to create a tabbed pane interface. A tabbed pane is a container that can store and organize multiple components into distinct tabs. It contains a collection of tabs. When you click on a tab, only data related to that tab will be displayed. JTabbedPane comes under the Java Swing package.
Constructor | Description |
|---|---|
JTabbedPane() | The JTabbedPane class in Java Swing has a default, no-argument constructor called JTabbedPane(). This constructor initializes an empty tabbed pane with no tabs and no initial content when a JTabbedPane is created. |
JTabbedPane(int tabPlacement) | The JTabbedPane(int tabPlacement) constructor allows to creation of a JTabbedPane with a defined initial location for the tabs. The tab placement option specifies whether the tabs appear at the top, bottom, left, or right of the tabbed pane. |
Method | Description |
|---|---|
addTab(String title, Component component) | Creates a new tab with the given title and content. |
removeTabAt(int index) | Removes the tab at the given index. |
getTabCount() | Returns the number of tabs present in the JTabbedPane. |
setSelectedIndex(int index) | Sets the chosen tab to the index given. |
getSelectedIndex() | Returns the index of the currently selected tab. |
Below is the implementation of the JTabbedPane:
Below is the implementation of JTabbedPane: