// Todo auto-generated method stub
Display display = display. getdefault ();
Shell shell = new shell (Display );
Shell. setlayout (New filllayout (SWT. Vertical ));
// Create a tabfolder object
// A tab folder (tabfolder) consists of one or more options (tabitem)
// A tabfolder consists of one or more tabitems, which are one-to-many relationships.
// Tabitem uses the setcontrol (Control) method to set the control display.
// Controls controlled by tabitem can be basic components or panel containers.
// The tab is placed at the bottom of the style: SWT. Bottom
// Final tabfolder = new tabfolder (shell, SWT. Bottom );
Final tabfolder = new tabfolder (shell, SWT. Top );
// Set the tab Layout
Tabfolder. setlayout (New filllayout ());
For (INT I = 1; I <4; I ++)
{
// Create a tabitem tab label object
Tabitem item = new tabitem (tabfolder, SWT. None );
// Set the text of the tab
Item. settext ("tab" + I );
Text T = new text (tabfolder, SWT. multi );
T. settext ("this is the" + I + "page ");
// Set the control controlled by the tab
Item. setcontrol (t );
// Create a tab icon
// Image = new image (display, PATH );
// Item. setimage (image );
}
Tabfolder. Pack ();
Shell. open ();
While (! Shell. isdisposed ())
{
If (! Display. readanddispatch ())
{
Display. Sleep ();
}
}
Display. Dispose ();
// Common tab Methods
// Obtain the tab of the specified index: tabitem getitem (INT index)
// Obtain the total number of tabs. The returned value is int: getitemcount ();
// Obtain the selected card array: getitems ();
// Obtain the Selected tab: getselection ()
// Obtain the index value of the currently selected tab. Return Value: INT: getselectionindex ();
// Check whether the specified option exists. INT: indexof (tabitem item) is returned. If so, the return tab is displayed.
// The index value. If the index does not exist,-1 is returned.
// Set the Selected tab: setselection (tabitem [] items );
// Setselection (INT index)