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

public Class CTabItem

extends Item
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.graphics.*, org.eclipse.swt.widgets.*

Instances of this class represent a selectable user interface object that represent a page in a notebook widget.
Styles:
SWT.CLOSE
Events:
(none)

Important Note

This class is not intended to be subclassed.

See Also
CTabFolder, CTabItem snippets, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv Rectangle
pack-priv Control
pack-priv Image
pack-priv Font
pack-priv Color
pack-priv int
pack-priv CTabFolder
pack-priv Color
pack-priv String
pack-priv int
pack-priv boolean
pack-priv boolean
pack-priv int
pack-priv String
pack-priv int
pack-priv int
x

pack-priv int
y

Constructor Summary

AccessConstructor and Description
public
CTabItem(CTabFolder
a CTabFolder 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 (which must be a CTabFolder) and a style value describing its behavior and appearance.

public
CTabItem(CTabFolder
a CTabFolder which will be the parent of the new instance (cannot be null)
parent
,
int
the style of control to construct
style
,
int
the zero-relative index to store the receiver in its parent
index
)

Constructs a new instance of this class given its parent (which must be a CTabFolder), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Overrides org.eclipse.swt.widgets.Widget.dispose.

Disposes of the operating system resources associated with the receiver and all its descendants.
public Rectangle

Returns:

the receiver's bounding column rectangle
getBounds
()

Returns a rectangle describing the receiver's size and location relative to its parent.

public Control

Returns:

the control
getControl
()

Gets the control that is displayed in the content area of the tab item.

public Image

Returns:

the disabled image or null
getDisabledImage
()

Deprecated the disabled image is not used
Get the image displayed in the tab if the tab is disabled.
public Font

Returns:

the receiver's font
getFont
()

Returns the font that the receiver will use to paint textual information.

public Color

Returns:

the receiver's foreground color
getForeground
()

Returns the foreground color that the receiver will use to paint textual information.

public CTabFolder

Returns:

the receiver's parent
getParent
()

Returns the receiver's parent, which must be a CTabFolder.

public Color

Returns:

the receiver's selection foreground color
getSelectionForeground
()

Returns the selection foreground color that the receiver will use to paint textual information.

public boolean

Returns:

true if the close button should be shown
getShowClose
()

Returns true to indicate that the receiver's close button should be shown.

public String

Returns:

the receiver's tool tip text
getToolTipText
()

Returns the receiver's tool tip text, or null if it has not been set.

public boolean

Returns:

true if the item will be rendered in the visible area of the CTabFolder. Returns false otherwise.
isShowing
()

Returns true if the item will be rendered in the visible area of the CTabFolder.

public void
setControl(Control
the new control (or null)
control
)

Sets the control that is used to fill the client area of the tab folder when the user selects the tab item.

public void
setDisabledImage(Image
the image to be displayed when the item is disabled or null
image
)

Deprecated This image is not used
Sets the image that is displayed if the tab item is disabled.
pack-priv boolean
public void
setFont(Font
the new font (or null)
font
)

Sets the font that the receiver will use to paint textual information for this item to the font specified by the argument, or to the default font for that kind of control if the argument is null.

public void
setForeground(Color
the new color (or null)
color
)

Sets the foreground color that the receiver will use to paint textual information for this item to the color specified by the argument, or to the default foreground color for that kind of control if the argument is null.

public void
setImage(Image
the image to display on the receiver (may be null)
image
)

Overrides org.eclipse.swt.widgets.Item.setImage.

Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.
public void
setSelectionForeground(Color
the new color (or null)
color
)

Sets the selection foreground color that the receiver will use to paint textual information for this item to the color specified by the argument, or to the default selection foreground color for that kind of control if the argument is null.

public void
setShowClose(boolean
the new state of the close button
close
)

Sets to true to indicate that the receiver's close button should be shown.

public void
setText(String
the tab name
string
)

Overrides org.eclipse.swt.widgets.Item.setText.

Sets the text to display on the tab.
public void
setToolTipText(String
the new tool tip text (or null)
string
)

Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown.

Inherited from org.eclipse.swt.widgets.Item:
checkSubclassgetImagegetText

Field Detail

closeImageStateback to summary
pack-priv int closeImageState
closeRectback to summary
pack-priv Rectangle closeRect
controlback to summary
pack-priv Control control
disabledImageback to summary
pack-priv Image disabledImage
fontback to summary
pack-priv Font font
foregroundback to summary
pack-priv Color foreground
heightback to summary
pack-priv int height
parentback to summary
pack-priv CTabFolder parent
selectionForegroundback to summary
pack-priv Color selectionForeground
shortenedTextback to summary
pack-priv String shortenedText
shortenedTextWidthback to summary
pack-priv int shortenedTextWidth
showCloseback to summary
pack-priv boolean showClose
showingback to summary
pack-priv boolean showing
stateback to summary
pack-priv int state

Hides org.eclipse.swt.widgets.Widget.state.

toolTipTextback to summary
pack-priv String toolTipText
widthback to summary
pack-priv int width
xback to summary
pack-priv int x
yback to summary
pack-priv int y

Constructor Detail

CTabItemback to summary
public CTabItem(CTabFolder parent, int style)

Constructs a new instance of this class given its parent (which must be a CTabFolder) and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent.

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:CTabFolder

a CTabFolder 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
See Also
SWT, Widget#getStyle()
CTabItemback to summary
public CTabItem(CTabFolder parent, int style, int index)

Constructs a new instance of this class given its parent (which must be a CTabFolder), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.

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:CTabFolder

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

style:int

the style of control to construct

index:int

the zero-relative index to store the receiver in its parent

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the parent is null
  • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the parent (inclusive)
SWTException:
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
See Also
SWT, Widget#getStyle()

Method Detail

disposeback to summary
public void dispose()

Overrides org.eclipse.swt.widgets.Widget.dispose.

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

Disposes of the operating system resources associated with the receiver and all its descendants. After this method has been invoked, the receiver and all descendants will answer true when sent the message isDisposed(). Any internal connections between the widgets in the tree will have been removed to facilitate garbage collection. This method does nothing if the widget is already disposed.

Note

This method is not called recursively on the descendants of the receiver. This means that, widget implementers can not detect when a widget is being disposed of by re-implementing this method, but should instead listen for the Dispose event.

Annotations
@Override
getBoundsback to summary
public Rectangle getBounds()

Returns a rectangle describing the receiver's size and location relative to its parent.

Returns:Rectangle

the receiver's bounding column rectangle

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
getControlback to summary
public Control getControl()

Gets the control that is displayed in the content area of the tab item.

Returns:Control

the control

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
getDisabledImageback to summary
public Image getDisabledImage()

Deprecated

the disabled image is not used

Get the image displayed in the tab if the tab is disabled.

Returns:Image

the disabled image or null

Annotations
@Deprecated
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
getFontback to summary
public Font getFont()

Returns the font that the receiver will use to paint textual information.

Returns:Font

the receiver's font

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
Since
3.0
getForegroundback to summary
public Color getForeground()

Returns the foreground color that the receiver will use to paint textual information.

Returns:Color

the receiver's foreground color

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
Since
3.114
getParentback to summary
public CTabFolder getParent()

Returns the receiver's parent, which must be a CTabFolder.

Returns:CTabFolder

the receiver's parent

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
getSelectionForegroundback to summary
public Color getSelectionForeground()

Returns the selection foreground color that the receiver will use to paint textual information.

Returns:Color

the receiver's selection foreground color

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
Since
3.114
getShowCloseback to summary
public boolean getShowClose()

Returns true to indicate that the receiver's close button should be shown. Otherwise return false. The initial value is defined by the style (SWT.CLOSE) that was used to create the receiver.

Returns:boolean

true if the close button should be shown

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
Since
3.4
getToolTipTextback to summary
public String getToolTipText()

Returns the receiver's tool tip text, or null if it has not been set.

Returns:String

the receiver's tool tip text

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
isShowingback to summary
public boolean isShowing()

Returns true if the item will be rendered in the visible area of the CTabFolder. Returns false otherwise.

Returns:boolean

true if the item will be rendered in the visible area of the CTabFolder. Returns false otherwise.

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
Since
3.0
setControlback to summary
public void setControl(Control control)

Sets the control that is used to fill the client area of the tab folder when the user selects the tab item.

Parameters
control:Control

the new control (or null)

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the control has been disposed
  • ERROR_INVALID_PARENT - if the control is not in the same widget tree
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setDisabledImageback to summary
public void setDisabledImage(Image image)

Deprecated

This image is not used

Sets the image that is displayed if the tab item is disabled. Null will clear the image.

Parameters
image:Image

the image to be displayed when the item is disabled or null

Annotations
@Deprecated
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
setFocusback to summary
pack-priv boolean setFocus()
setFontback to summary
public void setFont(Font font)

Sets the font that the receiver will use to paint textual information for this item to the font specified by the argument, or to the default font for that kind of control if the argument is null.

Parameters
font:Font

the new font (or null)

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
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.0
setForegroundback to summary
public void setForeground(Color color)

Sets the foreground color that the receiver will use to paint textual information for this item to the color specified by the argument, or to the default foreground color for that kind of control if the argument is null.

Parameters
color:Color

the new color (or null)

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
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.114
setImageback to summary
public void setImage(Image image)

Overrides org.eclipse.swt.widgets.Item.setImage.

Doc from org.eclipse.swt.widgets.Item.setImage.

Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.

Parameters
image:Image

the image to display on the receiver (may be null)

Annotations
@Override
setSelectionForegroundback to summary
public void setSelectionForeground(Color color)

Sets the selection foreground color that the receiver will use to paint textual information for this item to the color specified by the argument, or to the default selection foreground color for that kind of control if the argument is null.

Parameters
color:Color

the new color (or null)

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
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.114
setShowCloseback to summary
public void setShowClose(boolean close)

Sets to true to indicate that the receiver's close button should be shown. If the parent (CTabFolder) was created with SWT.CLOSE style, changing this value has no effect.

Parameters
close:boolean

the new state of the close button

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
Since
3.4
setTextback to summary
public void setText(String string)

Overrides org.eclipse.swt.widgets.Item.setText.

Sets the text to display on the tab. A carriage return '\n' allows to display multi line text.

Parameters
string:String

the tab name

Annotations
@Override
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
setToolTipTextback to summary
public void setToolTipText(String string)

Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown. For a control that has a default tool tip, such as the Tree control on Windows, setting the tool tip text to an empty string replaces the default, causing no tool tip text to be shown.

The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string.

Parameters
string:String

the new tool tip text (or null)

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