Top Description Fields Constructors Methods
org.eclipse.swt.widgets

public Class TabFolder

extends Composite
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.events.*, org.eclipse.swt.graphics.*, org.eclipse.swt.internal.*, org.eclipse.swt.internal.gtk.*, org.eclipse.swt.internal.gtk3.*, org.eclipse.swt.internal.gtk4.*

Instances of this class implement the notebook user interface metaphor. It allows the user to select a notebook page from set of pages.

The item children that may be added to instances of this class must be of type TabItem. Control children are created and then set into a tab item using TabItem#setControl.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.

Styles:
TOP, BOTTOM
Events:
Selection

Note

Only one of the styles TOP and BOTTOM may be specified.

Important Note

This class is not intended to be subclassed.

See Also
TabFolder, TabItem snippets, SWT Example: ControlExample, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv ImageList
pack-priv TabItem[]
Inherited from org.eclipse.swt.widgets.Composite:
backgroundModechildrenLoweredembeddedHandlefixClipHandlefixClipMapimHandlelayoutlayoutCountNO_INPUT_METHODnoChildDrawingpopupChildsocketHandletabList

Constructor Summary

AccessConstructor and Description
public
TabFolder(Composite
a composite control which will be the parent of the new instance (cannot be null)
parent
,
int
the style of control to construct
style
)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Method Summary

Modifier and TypeMethod and Description
pack-priv Control[]
public void
addSelectionListener(SelectionListener
the listener which should be notified when the user changes the receiver's selection
listener
)

Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in the SelectionListener interface.

pack-priv static int
protected void
checkSubclass()

Overrides org.eclipse.swt.widgets.Composite.checkSubclass.

Checks that this class can be subclassed.
pack-priv long
pack-priv Point
computeSizeInPixels(int wHint, int hHint, boolean changed)

Overrides org.eclipse.swt.widgets.Composite.computeSizeInPixels.

pack-priv Rectangle
computeTrimInPixels(int x, int y, int width, int height)

Overrides org.eclipse.swt.widgets.Scrollable.computeTrimInPixels.

pack-priv void
pack-priv void
createItem(TabItem item, int index)

pack-priv void
pack-priv void
pack-priv long
pack-priv Rectangle
public TabItem

Returns:

the item at the given index
getItem
(int
the index of the item to return
index
)

Returns the item at the given, zero-relative index in the receiver.

public TabItem

Returns:

the tab item at the given point, or null if the point is not in a tab item
getItem
(Point
the point used to locate the item
point
)

Returns the tab item at the given point in the receiver or null if no such item exists.

public int

Returns:

the number of items
getItemCount
()

Returns the number of items contained in the receiver.

public TabItem[]

Returns:

the items in the receiver
getItems
()

Returns an array of TabItems which are the items in the receiver.

public TabItem[]

Returns:

an array representing the selection
getSelection
()

Returns an array of TabItems that are currently selected in the receiver.

public int

Returns:

the index of the selected item
getSelectionIndex
()

Returns the zero-relative index of the item which is currently selected in the receiver, or -1 if no item is selected.

pack-priv long
gtk_focus(long widget, long directionType)

Overrides org.eclipse.swt.widgets.Composite.gtk_focus.

pack-priv long
gtk_switch_page(long notebook, long page, int page_num)

Overrides org.eclipse.swt.widgets.Widget.gtk_switch_page.

pack-priv void
public int

Returns:

the index of the item
indexOf
(TabItem
the search item
item
)

Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item.

pack-priv Point
minimumSize(int wHint, int hHint, boolean flushCache)

Overrides org.eclipse.swt.widgets.Composite.minimumSize.

pack-priv boolean
pack-priv boolean
pack-priv void
pack-priv void
pack-priv void
public void
removeSelectionListener(SelectionListener
the listener which should no longer be notified
listener
)

Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.

pack-priv void
pack-priv void
pack-priv int
setBounds(int x, int y, int width, int height, boolean move, boolean resize)

Overrides org.eclipse.swt.widgets.Composite.setBounds.

pack-priv void
pack-priv void
pack-priv void
public void
setSelection(int
the index of the item to select
index
)

Selects the item at the given zero-relative index in the receiver.

pack-priv void
setSelection(int index, boolean notify)

public void
setSelection(TabItem
the item to select
item
)

Sets the receiver's selection to the given item.

public void
setSelection(TabItem[]
the array of items
items
)

Sets the receiver's selection to be the given array of items.

pack-priv boolean
Inherited from org.eclipse.swt.widgets.Composite:
_getTabListadjustChildClippingapplyThemeBackgroundchangedcheckBufferedcheckSubwindowcomputeTabListconnectFixedHandleDrawcreateHandlederegisterdrawBackgrounddrawBackgroundInPixelsenableWidgetfindDeferredControlfindMenusfixChildrenfixClippingsfixModalfixParentGdkResourcefixStylefixTabListfixZOrderfocusHandleforceFocusgetBackgroundModegetChildrengetChildrenCountgetLayoutgetLayoutDeferredgetTabListgtk4_key_press_eventgtk_button_press_eventgtk_drawgtk_focus_in_eventgtk_focus_out_eventgtk_key_press_eventgtk_mapgtk_realizegtk_scroll_childgtk_style_updatedhasBorderhooksKeysimHandleisLayoutDeferredisTabGrouplayoutlayoutlayoutlayoutlayoutmarkLayoutmoveAbovemoveBelowmoveChildrenmustBeVisibleOnInitBoundsparentingHandleprintWidgetpropagateDrawredrawChildrenregisterreleaseHandleresizeHandlesetBackgroundModesetFocussetLayoutsetLayoutDeferredsetScrollBarVisiblesetTabGroupFocussetTabItemFocussetTabListshowWidgettoStringtranslateMnemonictranslateTraversaltraversalCodeupdateBackgroundModeupdateLayout

Field Detail

imageListback to summary
pack-priv ImageList imageList
itemsback to summary
pack-priv TabItem[] items

Constructor Detail

TabFolderback to summary
public TabFolder(Composite parent, int style)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

Parameters
parent:Composite

a composite control which will be the parent of the new instance (cannot be null)

style:int

the style of control to construct

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the parent is null
SWTException:
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
See Also
SWT, SWT#TOP, SWT#BOTTOM, Widget#checkSubclass, Widget#getStyle

Method Detail

_getChildrenback to summary
pack-priv Control[] _getChildren()

Overrides org.eclipse.swt.widgets.Composite._getChildren.

Annotations
@Override
addSelectionListenerback to summary
public void addSelectionListener(SelectionListener listener)

Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in the SelectionListener interface.

When widgetSelected is called, the item field of the event object is valid. widgetDefaultSelected is not called.

Parameters
listener:SelectionListener

the listener which should be notified when the user changes the receiver's selection

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also
SelectionListener, removeSelectionListener, SelectionEvent
checkStyleback to summary
pack-priv static int checkStyle(int style)

Hides org.eclipse.swt.widgets.Composite.checkStyle.

checkSubclassback to summary
protected void checkSubclass()

Overrides org.eclipse.swt.widgets.Composite.checkSubclass.

Doc from org.eclipse.swt.widgets.Widget.checkSubclass.

Checks that this class can be subclassed.

The SWT class library is intended to be subclassed only at specific, controlled points (most notably, Composite and Canvas when implementing new widgets). This method enforces this rule unless it is overridden.

Important Note

By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion.

The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy.

Annotations
@Override
clientHandleback to summary
pack-priv long clientHandle()

Overrides org.eclipse.swt.widgets.Scrollable.clientHandle.

Annotations
@Override
computeSizeInPixelsback to summary
pack-priv Point computeSizeInPixels(int wHint, int hHint, boolean changed)

Overrides org.eclipse.swt.widgets.Composite.computeSizeInPixels.

Annotations
@Override
computeTrimInPixelsback to summary
pack-priv Rectangle computeTrimInPixels(int x, int y, int width, int height)

Overrides org.eclipse.swt.widgets.Scrollable.computeTrimInPixels.

Annotations
@Override
createHandleback to summary
pack-priv void createHandle(int index)

Overrides org.eclipse.swt.widgets.Composite.createHandle.

Annotations
@Override
createItemback to summary
pack-priv void createItem(TabItem item, int index)
createWidgetback to summary
pack-priv void createWidget(int index)

Overrides org.eclipse.swt.widgets.Scrollable.createWidget.

Annotations
@Override
destroyItemback to summary
pack-priv void destroyItem(TabItem item)
eventHandleback to summary
pack-priv long eventHandle()

Overrides org.eclipse.swt.widgets.Control.eventHandle.

Annotations
@Override
getClientAreaInPixelsback to summary
pack-priv Rectangle getClientAreaInPixels()

Overrides org.eclipse.swt.widgets.Composite.getClientAreaInPixels.

Annotations
@Override
getItemback to summary
public TabItem getItem(int index)

Returns the item at the given, zero-relative index in the receiver. Throws an exception if the index is out of range.

Parameters
index:int

the index of the item to return

Returns:TabItem

the item at the given index

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getItemback to summary
public TabItem getItem(Point point)

Returns the tab item at the given point in the receiver or null if no such item exists. The point is in the coordinate system of the receiver.

Parameters
point:Point

the point used to locate the item

Returns:TabItem

the tab item at the given point, or null if the point is not in a tab item

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the point is null
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since
3.4
getItemCountback to summary
public int getItemCount()

Returns the number of items contained in the receiver.

Returns:int

the number of items

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getItemsback to summary
public TabItem[] getItems()

Returns an array of TabItems which are the items in the receiver.

Note

This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.

Returns:TabItem[]

the items in the receiver

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getSelectionback to summary
public TabItem[] getSelection()

Returns an array of TabItems that are currently selected in the receiver. An empty array indicates that no items are selected.

Note

This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.

Returns:TabItem[]

an array representing the selection

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getSelectionIndexback to summary
public int getSelectionIndex()

Returns the zero-relative index of the item which is currently selected in the receiver, or -1 if no item is selected.

Returns:int

the index of the selected item

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
gtk_focusback to summary
pack-priv long gtk_focus(long widget, long directionType)

Overrides org.eclipse.swt.widgets.Composite.gtk_focus.

Annotations
@Override
gtk_switch_pageback to summary
pack-priv long gtk_switch_page(long notebook, long page, int page_num)

Overrides org.eclipse.swt.widgets.Widget.gtk_switch_page.

Annotations
@Override
hookEventsback to summary
pack-priv void hookEvents()

Overrides org.eclipse.swt.widgets.Composite.hookEvents.

Annotations
@Override
indexOfback to summary
public int indexOf(TabItem item)

Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item. If no item is found, returns -1.

Parameters
item:TabItem

the search item

Returns:int

the index of the item

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the item is null
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
minimumSizeback to summary
pack-priv Point minimumSize(int wHint, int hHint, boolean flushCache)

Overrides org.eclipse.swt.widgets.Composite.minimumSize.

Annotations
@Override
mnemonicHitback to summary
pack-priv boolean mnemonicHit(char key)

Overrides org.eclipse.swt.widgets.Control.mnemonicHit.

Annotations
@Override
mnemonicMatchback to summary
pack-priv boolean mnemonicMatch(char key)

Overrides org.eclipse.swt.widgets.Control.mnemonicMatch.

Annotations
@Override
releaseChildrenback to summary
pack-priv void releaseChildren(boolean destroy)

Overrides org.eclipse.swt.widgets.Composite.releaseChildren.

Annotations
@Override
releaseWidgetback to summary
pack-priv void releaseWidget()

Overrides org.eclipse.swt.widgets.Composite.releaseWidget.

Annotations
@Override
removeControlback to summary
pack-priv void removeControl(Control control)

Overrides org.eclipse.swt.widgets.Composite.removeControl.

Annotations
@Override
removeSelectionListenerback to summary
public void removeSelectionListener(SelectionListener listener)

Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.

Parameters
listener:SelectionListener

the listener which should no longer be notified

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also
SelectionListener, addSelectionListener
reskinChildrenback to summary
pack-priv void reskinChildren(int flags)

Overrides org.eclipse.swt.widgets.Composite.reskinChildren.

Annotations
@Override
setBackgroundGdkRGBAback to summary
pack-priv void setBackgroundGdkRGBA(long context, long handle, GdkRGBA rgba)

Overrides org.eclipse.swt.widgets.Control.setBackgroundGdkRGBA.

Annotations
@Override
setBoundsback to summary
pack-priv int setBounds(int x, int y, int width, int height, boolean move, boolean resize)

Overrides org.eclipse.swt.widgets.Composite.setBounds.

Annotations
@Override
setFontDescriptionback to summary
pack-priv void setFontDescription(long font)

Overrides org.eclipse.swt.widgets.Control.setFontDescription.

Annotations
@Override
setForegroundGdkRGBAback to summary
pack-priv void setForegroundGdkRGBA(GdkRGBA rgba)

Overrides org.eclipse.swt.widgets.Control.setForegroundGdkRGBA.

Annotations
@Override
setOrientationback to summary
pack-priv void setOrientation(boolean create)

Overrides org.eclipse.swt.widgets.Composite.setOrientation.

Annotations
@Override
setSelectionback to summary
public void setSelection(int index)

Selects the item at the given zero-relative index in the receiver. If the item at the index was already selected, it remains selected. The current selection is first cleared, then the new items are selected. Indices that are out of range are ignored.

Parameters
index:int

the index of the item to select

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setSelectionback to summary
pack-priv void setSelection(int index, boolean notify)
setSelectionback to summary
public void setSelection(TabItem item)

Sets the receiver's selection to the given item. The current selected is first cleared, then the new item is selected.

Parameters
item:TabItem

the item to select

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the item is null
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since
3.2
setSelectionback to summary
public void setSelection(TabItem[] items)

Sets the receiver's selection to be the given array of items. The current selected is first cleared, then the new items are selected.

Parameters
items:TabItem[]

the array of items

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the items array is null
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
traversePageback to summary
pack-priv boolean traversePage(final boolean next)

Overrides org.eclipse.swt.widgets.Control.traversePage.

Annotations
@Override