Tab sheets
A TabSheet
allows users to alternate between views by using tabs. A user only sees the content of one tab at a time. Tabbed views are useful to logically break content up so users can more comfortably work with some components in a large area than if we put all the components in a single view.
To create an empty tab sheet, instantiate a new TabSheet
object like this:
TabSheet tabs = new TabSheet();
You have two ways to add tabs. You can use the addTab
method that takes two parameters, the first is the component that will go inside the tab, and the second is the title for the tab itself:
tabs.addTab(new Label("Label 1"), "Tabl 1");
Or you can use the
addTab
method that takes only one parameter, the component to add inside the tab. This method returns a Tab
object representing the added tab. Tab
, in turn, has a method to set the caption for the tab it represents:
tabs.addTab(new Label("Label 2")).setCaption("Tab 2");
This last one is similar to this:
Tab tab = tabs.addTab(new Label("Label...