TabbedPane
The TabbedPane
class provides a compact and organized way of displaying content that is divided into multiple sections, each associated with a Tab
. Users can switch between these sections by clicking on the respective tabs, often labeled with text and/or icons. This class simplifies the creation of multifaceted interfaces where different content or forms need to be accessible but not simultaneously visible.
Usages
The TabbedPane
class is a gives developers a powerful tool for organizing and presenting multiple tabs or sections within a UI. Here are some typical scenarios where you might utilize a TabbedPane
in your application:
-
Document Viewer: Implementing a document viewer where each tab represents a different document or file. Users can easily switch between open documents for efficient multitasking.
-
Data Management:: Utilize a
TabbedPane
to organize data management tasks, for instance:- Different dataset to be displayed in an application
- Various user profiles can be displayed within separate tabs
- Different profiles in a user management system
-
Module Selection: A
TabbedPane
can represent different modules or sections. Each tab can encapsulate the functionalities of a specific module, enabling users to focus on one aspect of the application at a time. -
Task Management: Task management applications can use a
TabbedPane
to represent various projects or tasks. Each tab could correspond to a specific project, allowing users to manage and track tasks separately. -
Program Navigation: Within an application that needs to run various programs, a
TabbedPane
could:- Serve as a sidebar which allows for different applications or programs to be run within a single application, such as what is shown in the
AppLayout
template - Create a top bar which can serve a similar purpose, or represent sub-applications within an already selected application.
- Serve as a sidebar which allows for different applications or programs to be run within a single application, such as what is shown in the
Tabs
Tabs are UI elements that can be added to tabbed panes to organize and switch between different content views.
Tabs are not intended to be used as standalone components. They are meant to be used in conjunction with tabbed panes. This class is not a Component
and should not be used as such.
Properties
Tabs are comprised of the following properties, which are then used when adding them in a TabbedPane
. These properties have getters and setters to facilitate customization within a TabbedPane
.
-
Key(
Object
): Represents the unique identifier for theTab
. -
Text(
String
): The text that will be displayed as a title for theTab
within theTabbedPane
. This is also referred to as the title via thegetTitle()
andsetTitle(String title)
methods. -
Tooltip(
String
): The tooltip text that is associated with theTab
, which will be displayed when the cursor hovers over theTab
. -
Enabled(
boolean
): Represents whether theTab
is currently enabled or not. Can be modified with thesetEnabled(boolean enabled)
method. -
Closeable(
boolean
): Represents whether theTab
can be closed. Can be modified with thesetCloseable(boolean enabled)
method. This will add a close button on theTab
which can be clicked on by the user, and fires a removal event. TheTabbedPane
component dictates how to handle the removal. -
Slot(
Component
): Slots provide flexible options for improving the capability of aTab
. You can have icons, labels, loading spinners, clear/reset capability, avatar/profile pictures, and other beneficial components nested within aTab
to further clarify intended meaning to users. You can add a component to theprefix
slot of aTab
during construction. Alternatively, you can use thesetPrefixComponent()
andsetSuffixComponent()
methods to insert various components before and after the displayed option within aTab
.TabbedPane pane = new TabbedPane();
pane.addTab(new Tab("Documents", TablerIcon.create("files")));