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

public Class TableColumn

extends Item
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 represent a column in a table widget.
Styles:
LEFT, RIGHT, CENTER
Events:
Move, Resize, Selection

Note

Only one of the styles LEFT, RIGHT and CENTER may be specified.

Important Note

This class is not intended to be subclassed.

See Also
Table, TableItem, TableColumn snippets, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv long
pack-priv boolean
pack-priv long
pack-priv long
pack-priv long
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv Table
pack-priv String
pack-priv boolean
Inherited from org.eclipse.swt.widgets.Item:
ELLIPSISimagetextTEXT_LIMIT

Constructor Summary

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

public
TableColumn(Table
a composite control 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 Table), 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
addControlListener(ControlListener
the listener which should be notified
listener
)

Adds the listener to the collection of listeners who will be notified when the control is moved or resized, by sending it one of the messages defined in the ControlListener interface.

public void
addSelectionListener(SelectionListener
the listener which should be notified when the control is selected by the user
listener
)

Adds the listener to the collection of listeners who will be notified when the control is selected by the user, by sending it one of the messages defined in the SelectionListener interface.

pack-priv static int
checkStyle(int style)

protected void
checkSubclass()

Overrides org.eclipse.swt.widgets.Item.checkSubclass.

Checks that this class can be subclassed.
pack-priv void
pack-priv void
pack-priv void
public void
dispose()

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

Disposes of the operating system resources associated with the receiver and all its descendants.
pack-priv long
dpiChanged(long object, long arg0)

Overrides org.eclipse.swt.widgets.Widget.dpiChanged.

public int

Returns:

the alignment
getAlignment
()

Returns a value which describes the position of the text or image in the receiver.

public boolean

Returns:

the moveable attribute
getMoveable
()

Gets the moveable attribute.

public Table

Returns:

the receiver's parent
getParent
()

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

public boolean

Returns:

the resizable attribute
getResizable
()

Gets the resizable attribute.

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 int

Returns:

the width
getWidth
()

Gets the width of the receiver.

pack-priv int
pack-priv long
pack-priv long
pack-priv long
pack-priv long
pack-priv void
public void
pack()

Causes the receiver to be resized to its preferred size.

pack-priv void
pack-priv void
pack-priv void
public void
removeControlListener(ControlListener
the listener which should no longer be notified
listener
)

Removes the listener from the collection of listeners who will be notified when the control is moved or resized.

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 control is selected by the user.

public void
setAlignment(int
the new alignment
alignment
)

Controls how text and images will be displayed in the receiver.

pack-priv void
setFontDescription(long font)

pack-priv void
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
setMoveable(boolean
the moveable attribute
moveable
)

Sets the moveable attribute.

pack-priv void
public void
setResizable(boolean
the resize attribute
resizable
)

Sets the resizable attribute.

public void
setText(String
the new text
string
)

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

Sets the receiver's text.
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.

public void
setWidth(int
the new width
width
)

Sets the width of the receiver.

pack-priv void
setWidthInPixels(int width)

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

Field Detail

buttonHandleback to summary
pack-priv long buttonHandle
customDrawback to summary
pack-priv boolean customDraw
headerButtonCSSProviderback to summary
pack-priv long headerButtonCSSProvider
imageHandleback to summary
pack-priv long imageHandle
labelHandleback to summary
pack-priv long labelHandle
lastButtonback to summary
pack-priv int lastButton
lastTimeback to summary
pack-priv int lastTime
lastWidthback to summary
pack-priv int lastWidth
lastXback to summary
pack-priv int lastX
modelIndexback to summary
pack-priv int modelIndex
parentback to summary
pack-priv Table parent
toolTipTextback to summary
pack-priv String toolTipText
useFixedWidthback to summary
pack-priv boolean useFixedWidth

Constructor Detail

TableColumnback to summary
public TableColumn(Table parent, int style)

Constructs a new instance of this class given its parent (which must be a Table) 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:Table

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#LEFT, SWT#RIGHT, SWT#CENTER, Widget#checkSubclass, Widget#getStyle
TableColumnback to summary
public TableColumn(Table parent, int style, int index)

Constructs a new instance of this class given its parent (which must be a Table), 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.

Note that due to a restriction on some platforms, the first column is always left aligned.

Parameters
parent:Table

a composite control 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
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
See Also
SWT#LEFT, SWT#RIGHT, SWT#CENTER, Widget#checkSubclass, Widget#getStyle

Method Detail

addControlListenerback to summary
public void addControlListener(ControlListener listener)

Adds the listener to the collection of listeners who will be notified when the control is moved or resized, by sending it one of the messages defined in the ControlListener interface.

Parameters
listener:ControlListener

the listener which should 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
ControlListener, removeControlListener
addSelectionListenerback to summary
public void addSelectionListener(SelectionListener listener)

Adds the listener to the collection of listeners who will be notified when the control is selected by the user, by sending it one of the messages defined in the SelectionListener interface.

widgetSelected is called when the column header is selected. widgetDefaultSelected is not called.

Parameters
listener:SelectionListener

the listener which should be notified when the control is selected by the user

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)
checkSubclassback to summary
protected void checkSubclass()

Overrides org.eclipse.swt.widgets.Item.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
createWidgetback to summary
pack-priv void createWidget(int index)

Overrides org.eclipse.swt.widgets.Widget.createWidget.

Annotations
@Override
deregisterback to summary
pack-priv void deregister()

Overrides org.eclipse.swt.widgets.Widget.deregister.

Annotations
@Override
destroyWidgetback to summary
pack-priv void destroyWidget()

Overrides org.eclipse.swt.widgets.Widget.destroyWidget.

Annotations
@Override
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
dpiChangedback to summary
pack-priv long dpiChanged(long object, long arg0)

Overrides org.eclipse.swt.widgets.Widget.dpiChanged.

Annotations
@Override
getAlignmentback to summary
public int getAlignment()

Returns a value which describes the position of the text or image in the receiver. The value will be one of LEFT, RIGHT or CENTER.

Returns:int

the alignment

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
getMoveableback to summary
public boolean getMoveable()

Gets the moveable attribute. A column that is not moveable cannot be reordered by the user by dragging the header but may be reordered by the programmer.

Returns:boolean

the moveable attribute

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.1
See Also
Table#getColumnOrder(), Table#setColumnOrder(int[]), TableColumn#setMoveable(boolean), SWT#Move
getParentback to summary
public Table getParent()

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

Returns:Table

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
getResizableback to summary
public boolean getResizable()

Gets the resizable attribute. A column that is not resizable cannot be dragged by the user but may be resized by the programmer.

Returns:boolean

the resizable attribute

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
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
Since
3.2
getWidthback to summary
public int getWidth()

Gets the width of the receiver.

Returns:int

the width

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
getWidthInPixelsback to summary
pack-priv int getWidthInPixels()
gtk_clickedback to summary
pack-priv long gtk_clicked(long widget)

Overrides org.eclipse.swt.widgets.Widget.gtk_clicked.

Annotations
@Override
gtk_event_afterback to summary
pack-priv long gtk_event_after(long widget, long gdkEvent)

Overrides org.eclipse.swt.widgets.Widget.gtk_event_after.

Annotations
@Override
gtk_mnemonic_activateback to summary
pack-priv long gtk_mnemonic_activate(long widget, long arg1)

Overrides org.eclipse.swt.widgets.Widget.gtk_mnemonic_activate.

Annotations
@Override
gtk_size_allocateback to summary
pack-priv long gtk_size_allocate(long widget, long allocation)

Overrides org.eclipse.swt.widgets.Widget.gtk_size_allocate.

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

Overrides org.eclipse.swt.widgets.Widget.hookEvents.

Annotations
@Override
packback to summary
public void pack()

Causes the receiver to be resized to its preferred size. For a composite, this involves computing the preferred size from its layout, if there is one.

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
registerback to summary
pack-priv void register()

Overrides org.eclipse.swt.widgets.Widget.register.

Annotations
@Override
releaseHandleback to summary
pack-priv void releaseHandle()

Overrides org.eclipse.swt.widgets.Widget.releaseHandle.

Annotations
@Override
releaseParentback to summary
pack-priv void releaseParent()

Overrides org.eclipse.swt.widgets.Widget.releaseParent.

Annotations
@Override
removeControlListenerback to summary
public void removeControlListener(ControlListener listener)

Removes the listener from the collection of listeners who will be notified when the control is moved or resized.

Parameters
listener:ControlListener

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
ControlListener, addControlListener
removeSelectionListenerback to summary
public void removeSelectionListener(SelectionListener listener)

Removes the listener from the collection of listeners who will be notified when the control is selected by the user.

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
setAlignmentback to summary
public void setAlignment(int alignment)

Controls how text and images will be displayed in the receiver. The argument should be one of LEFT, RIGHT or CENTER.

Note that due to a restriction on some platforms, the first column is always left aligned.

Parameters
alignment:int

the new alignment

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
setFontDescriptionback to summary
pack-priv void setFontDescription(long font)
setHeaderCSSback to summary
pack-priv void setHeaderCSS(String css)
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
setMoveableback to summary
public void setMoveable(boolean moveable)

Sets the moveable attribute. A column that is moveable can be reordered by the user by dragging the header. A column that is not moveable cannot be dragged by the user but may be reordered by the programmer.

Parameters
moveable:boolean

the moveable attribute

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.1
See Also
Table#setColumnOrder(int[]), Table#getColumnOrder(), TableColumn#getMoveable(), SWT#Move
setOrientationback to summary
pack-priv void setOrientation(boolean create)

Overrides org.eclipse.swt.widgets.Widget.setOrientation.

Annotations
@Override
setResizableback to summary
public void setResizable(boolean resizable)

Sets the resizable attribute. A column that is resizable can be resized by the user dragging the edge of the header. A column that is not resizable cannot be dragged by the user but may be resized by the programmer.

Parameters
resizable:boolean

the resize attribute

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

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

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

Sets the receiver's text.

Note

If control characters like '\n', '\t' etc. are used in the string, then the behavior is platform dependent.

Parameters
string:String

the new text

Annotations
@Override
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.

Note

This operation is a hint and behavior is platform specific, on Windows for CJK-style mnemonics of the form " (&C)" at the end of the tooltip text are not shown in tooltip.

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
Since
3.2
setWidthback to summary
public void setWidth(int width)

Sets the width of the receiver.

Parameters
width:int

the new width

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
setWidthInPixelsback to summary
pack-priv void setWidthInPixels(int width)