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

public Class ToolTip

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

Instances of this class represent popup windows that are used to inform or warn the user.
Styles:
BALLOON, ICON_ERROR, ICON_INFORMATION, ICON_WARNING
Events:
Selection

Note

Only one of the styles ICON_ERROR, ICON_INFORMATION, and ICON_WARNING may be specified.

Important Note

This class is not intended to be subclassed.

Since
3.2
See Also
Tool Tips snippets, SWT Example: ControlExample, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv static final int
pack-priv int[]
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv TrayItem
pack-priv long
pack-priv long
pack-priv String
pack-priv static final int
pack-priv Shell
pack-priv long
pack-priv boolean
pack-priv String
pack-priv int
pack-priv static final int
pack-priv int
x

pack-priv int
y

Inherited from org.eclipse.swt.widgets.Widget:
ACTIVATEACTIVATE_INVERSEAUTO_TEXT_DIRECTIONBACKGROUNDBACKSPACEBACKSPACE_INVERSEBUTTON_PRESS_EVENTBUTTON_PRESS_EVENT_INVERSEBUTTON_RELEASE_EVENTBUTTON_RELEASE_EVENT_INVERSECANVASCHANGE_VALUECHANGEDCHECK_SUBWINDOWCLICKEDCLOSE_REQUESTCOMMITCOMPUTE_SIZECONFIGURE_EVENTCOPY_CLIPBOARDCOPY_CLIPBOARD_INVERSECREATE_MENU_PROXYCUT_CLIPBOARDCUT_CLIPBOARD_INVERSEdataDAY_SELECTEDDAY_SELECTED_DOUBLE_CLICKDECELERATEDEFAULT_HEIGHTDEFAULT_WIDTHDELETE_EVENTDELETE_FROM_CURSORDELETE_FROM_CURSOR_INVERSEDELETE_RANGEDELETE_TEXTDIRECTION_CHANGEDDISABLEDdisplayDISPOSE_SENTDISPOSEDDPI_CHANGEDDRAG_DETECTDRAWENTERENTER_NOTIFY_EVENTEVENTEVENT_AFTEReventTableEXPAND_COLLAPSE_CURSOR_ROWEXPOSE_EVENTEXPOSE_EVENT_INVERSEFOCUSFOCUS_INFOCUS_IN_EVENTFOCUS_OUTFOCUS_OUT_EVENTFONTFOREGROUNDFOREIGN_HANDLEgdkSeatGrabPrepareFuncGESTURE_PRESSEDGESTURE_RELEASEDGRAB_FOCUShandleHANDLEHAS_AUTO_DIRECTIONHIDDENHIDEICON_RELEASEIM_UPDATEINPUTINSERT_TEXTIS_ACTIVEKEY_CHECK_SUBWINDOWKEY_GTK_CSSKEY_PRESS_EVENTKEY_PRESSEDKEY_RELEASE_EVENTKEY_RELEASEDKEYED_DATALAST_SIGNALLAYOUT_CHANGEDLAYOUT_CHILDLAYOUT_NEEDEDLEAVELEAVE_NOTIFY_EVENTMAPMAP_EVENTMENUMNEMONIC_ACTIVATEMONTH_CHANGEDMOTIONMOTION_INVERSEMOTION_NOTIFY_EVENTMOTION_NOTIFY_EVENT_INVERSEMOVE_CURSORMOVE_CURSOR_INVERSEMOVE_FOCUSMOVEDNOTIFY_DEFAULT_HEIGHTNOTIFY_DEFAULT_WIDTHNOTIFY_MAXIMIZEDNOTIFY_STATEOBSCUREDOUTPUTPARENT_BACKGROUNDPASTE_CLIPBOARDPASTE_CLIPBOARD_INVERSEPOPPED_UPPOPULATE_POPUPPOPUP_MENUPREEDIT_CHANGEDREALIZERELEASEDRESIZEDROW_ACTIVATEDROW_DELETEDROW_HAS_CHILD_TOGGLEDROW_INSERTEDSCROLLSCROLL_BEGINSCROLL_CHILDSCROLL_ENDSCROLL_EVENTSELECTSELECTION_DONESHOWSHOW_HELPSIZE_ALLOCATESIZE_ALLOCATE_GTK4SKIN_NEEDEDSTART_INTERACTIVE_SEARCHstateSTATUS_ICON_POPUP_MENUstyleSTYLE_UPDATEDSWITCH_PAGETEST_COLLAPSE_ROWTEST_EXPAND_ROWTEXT_BUFFER_INSERT_TEXTTHEME_BACKGROUNDTOGGLEDUNMAPUNMAP_EVENTUNREALIZEVALUE_CHANGEDWINDOW_STATE_EVENTZERO_HEIGHTZERO_WIDTH

Constructor Summary

AccessConstructor and Description
public
ToolTip(Shell
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
public void
addSelectionListener(SelectionListener
the listener which should be notified when the receiver is selected by the user
listener
)

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

pack-priv static int
checkStyle(int style)

pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
drawTooltip(long cairo)

public boolean

Returns:

the receiver's auto hide state
getAutoHide
()

Returns true if the receiver is automatically hidden by the platform, and false otherwise.

pack-priv Point
public String

Returns:

the receiver's message
getMessage
()

Returns the receiver's message, which will be an empty string if it has never been set.

pack-priv String
public Shell

Returns:

the receiver's parent
getParent
()

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

pack-priv Point
getSize(int maxWidth)

public String

Returns:

the receiver's text
getText
()

Returns the receiver's text, which will be an empty string if it has never been set.

public boolean

Returns:

the receiver's visibility state
getVisible
()

Returns true if the receiver is visible, and false otherwise.

pack-priv long
pack-priv void
pack-priv long
gtk_draw(long widget, long cairo)

Overrides org.eclipse.swt.widgets.Widget.gtk_draw.

pack-priv long
pack-priv void
public boolean

Returns:

the receiver's visibility state
isVisible
()

Returns true if the receiver is visible and all of the receiver's ancestors are visible and false otherwise.

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

public void
setAutoHide(boolean
the auto hide state
autoHide
)

Makes the receiver hide automatically when true, and remain visible when false.

public void
setLocation(int
the new x coordinate for the receiver
x
,
int
the new y coordinate for the receiver
y
)

Sets the location of the receiver, which must be a tooltip, to the point specified by the arguments which are relative to the display.

public void
setLocation(Point
the new location for the receiver
location
)

Sets the location of the receiver, which must be a tooltip, to the point specified by the argument which is relative to the display.

pack-priv void
setLocationInPixels(int x, int y)

pack-priv void
public void
setMessage(String
the new message
string
)

Sets the receiver's message.

public void
setText(String
the new text
string
)

Sets the receiver's text.

public void
setVisible(boolean
the new visibility state
visible
)

Marks the receiver as visible if the argument is true, and marks it invisible otherwise.

pack-priv long
Inherited from org.eclipse.swt.widgets.Widget:
_addListeneraddDisposeListeneraddListenercellDataProccheckBitscheckOpencheckOrientationcheckParentcheckSubclasscheckWidgetconvertPangoFontDescriptionToCsscssHandlederegisterdisposedpiChangedenterMotionProcerrorfilterProcfiltersfixMnemonicfixMnemonicfixMnemonicfocusProcfontHeightgdk_event_freegdk_event_get_stategdk_event_get_surface_or_windowgdk_pointer_grabgdk_pointer_ungrabgdk_surface_get_sizegdk_window_get_sizeGdkSeatGrabPrepareFuncgesturePressReleaseProcgetDatagetDatagetDisplaygetListenersgetNamegetStylegtk3_show_helpgtk4_drawgtk4_enter_eventgtk4_focus_enter_eventgtk4_focus_leave_eventgtk4_focus_window_eventgtk4_key_press_eventgtk4_key_release_eventgtk4_leave_eventgtk4_motion_eventgtk4_scroll_eventgtk_activategtk_adjustment_getgtk_box_newgtk_box_pack_endgtk_box_set_child_packinggtk_button_release_eventgtk_cell_renderer_get_preferred_sizegtk_change_valuegtk_changedgtk_clickedgtk_close_requestgtk_commitgtk_configure_eventgtk_container_get_border_width_or_margingtk_container_set_border_widthgtk_create_menu_proxygtk_day_selectedgtk_day_selected_double_clickgtk_delete_eventgtk_delete_rangegtk_delete_textgtk_enter_notify_eventgtk_event_aftergtk_expand_collapse_cursor_rowgtk_focusgtk_focus_in_eventgtk_focus_out_eventgtk_gesture_press_eventgtk_gesture_release_eventgtk_grab_focusgtk_hidegtk_icon_releasegtk_inputgtk_insert_textgtk_key_press_eventgtk_key_release_eventgtk_leave_notify_eventgtk_mapgtk_map_eventgtk_menu_popped_upgtk_mnemonic_activategtk_month_changedgtk_motion_notify_eventgtk_move_focusgtk_outputgtk_populate_popupgtk_popup_menugtk_preedit_changedgtk_realizegtk_row_activatedgtk_row_has_child_toggledgtk_scroll_childgtk_scroll_eventgtk_selectgtk_selection_donegtk_showgtk_start_interactive_searchgtk_status_icon_popup_menugtk_style_updatedgtk_switch_pagegtk_test_collapse_rowgtk_test_expand_rowgtk_text_buffer_insert_textgtk_timergtk_toggledgtk_tree_view_column_cell_get_positiongtk_unmapgtk_unmap_eventgtk_unrealizegtk_value_changedgtk_widget_get_preferred_sizegtk_widget_get_surfacegtk_widget_get_windowgtk_widget_size_allocategtk_window_state_eventhookshoverProcisActiveisAutoDirectionisDisposedisListeningisValidSubclassisValidThreadkeyPressReleaseProcleaveProcmnemonicHitmnemonicMatchnotifyCreationTrackernotifyDisposalTrackernotifyListenersnotifyProcnotifyStatepaintSurfacepaintWindowpostEventpostEventregisterreleasereleaseChildrenreleaseHandlereleaseParentremoveDisposeListenerremoveListenerremoveListenerrendererGetPreferredWidthProcrendererRenderProcrendererSnapshotProcreskinreskinChildrenreskinWidgetscrollProcsendEventsendEventsendEventsendEventsendIMKeyEventsendKeyEventsendSelectionEventsendSelectionEventsetButtonStatesetDatasetDatasetFontDescriptionsetInputStatesetKeyStatesetLocationStatesetOrientationsetTabGroupFocussetTabItemFocussetToolTipTextshellMapProcsizeAllocateProcsizeRequestProcsnapshotToDrawtopHandletoStringtranslateTraversalwindowActiveProcwindowProcwindowProcwindowProcwindowProcwindowProc

Field Detail

autohideback to summary
pack-priv boolean autohide
BORDERback to summary
pack-priv static final int BORDER
borderPolygonback to summary
pack-priv int[] borderPolygon
DELAYback to summary
pack-priv static final int DELAY
IMAGE_SIZEback to summary
pack-priv static final int IMAGE_SIZE
INSETback to summary
pack-priv static final int INSET
itemback to summary
pack-priv TrayItem item
layoutMessageback to summary
pack-priv long layoutMessage
layoutTextback to summary
pack-priv long layoutText
messageback to summary
pack-priv String message
PADDINGback to summary
pack-priv static final int PADDING
parentback to summary
pack-priv Shell parent
providerback to summary
pack-priv long provider
spikeAboveback to summary
pack-priv boolean spikeAbove
textback to summary
pack-priv String text
timerIdback to summary
pack-priv int timerId
TIP_HEIGHTback to summary
pack-priv static final int TIP_HEIGHT
xback to summary
pack-priv int x
yback to summary
pack-priv int y

Constructor Detail

ToolTipback to summary
public ToolTip(Shell 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:Shell

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#BALLOON, SWT#ICON_ERROR, SWT#ICON_INFORMATION, SWT#ICON_WARNING, Widget#checkSubclass, Widget#getStyle

Method Detail

addSelectionListenerback to summary
public void addSelectionListener(SelectionListener listener)

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

widgetSelected is called when the receiver is selected. widgetDefaultSelected is not called.

Parameters
listener:SelectionListener

the listener which should be notified when the receiver 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)
configureback to summary
pack-priv void configure()
createHandleback to summary
pack-priv void createHandle(int index)

Overrides org.eclipse.swt.widgets.Widget.createHandle.

Annotations
@Override
createWidgetback to summary
pack-priv void createWidget(int index)

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

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

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

Annotations
@Override
drawTooltipback to summary
pack-priv void drawTooltip(long cairo)
getAutoHideback to summary
public boolean getAutoHide()

Returns true if the receiver is automatically hidden by the platform, and false otherwise.

Returns:boolean

the receiver's auto hide state

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
getLocationback to summary
pack-priv Point getLocation()
getMessageback to summary
public String getMessage()

Returns the receiver's message, which will be an empty string if it has never been set.

Returns:String

the receiver's message

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
getNameTextback to summary
pack-priv String getNameText()

Overrides org.eclipse.swt.widgets.Widget.getNameText.

Annotations
@Override
getParentback to summary
public Shell getParent()

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

Returns:Shell

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
getSizeback to summary
pack-priv Point getSize(int maxWidth)
getTextback to summary
public String getText()

Returns the receiver's text, which will be an empty string if it has never been set.

Returns:String

the receiver's 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
getVisibleback to summary
public boolean getVisible()

Returns true if the receiver is visible, and false otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.

Returns:boolean

the receiver's visibility state

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_button_press_eventback to summary
pack-priv long gtk_button_press_event(long widget, long event)

Overrides org.eclipse.swt.widgets.Widget.gtk_button_press_event.

Annotations
@Override
gtk_css_provider_load_from_cssback to summary
pack-priv void gtk_css_provider_load_from_css(long context, String css)
gtk_drawback to summary
pack-priv long gtk_draw(long widget, long cairo)

Overrides org.eclipse.swt.widgets.Widget.gtk_draw.

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
isVisibleback to summary
public boolean isVisible()

Returns true if the receiver is visible and all of the receiver's ancestors are visible and false otherwise.

Returns:boolean

the receiver's visibility state

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
See Also
getVisible
releaseWidgetback to summary
pack-priv void releaseWidget()

Overrides org.eclipse.swt.widgets.Widget.releaseWidget.

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

Removes the listener from the collection of listeners who will be notified when the receiver 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
setAutoHideback to summary
public void setAutoHide(boolean autoHide)

Makes the receiver hide automatically when true, and remain visible when false.

Parameters
autoHide:boolean

the auto hide state

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
See Also
getVisible, setVisible
setLocationback to summary
public void setLocation(int x, int y)

Sets the location of the receiver, which must be a tooltip, to the point specified by the arguments which are relative to the display.

Note that this is different from most widgets where the location of the widget is relative to the parent.

Parameters
x:int

the new x coordinate for the receiver

y:int

the new y coordinate for 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
setLocationback to summary
public void setLocation(Point location)

Sets the location of the receiver, which must be a tooltip, to the point specified by the argument which is relative to the display.

Note that this is different from most widgets where the location of the widget is relative to the parent.

Note that the platform window manager ultimately has control over the location of tooltips.

Parameters
location:Point

the new location for the receiver

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
setLocationInPixelsback to summary
pack-priv void setLocationInPixels(int x, int y)
setLocationInPixelsback to summary
pack-priv void setLocationInPixels(Point location)
setMessageback to summary
public void setMessage(String string)

Sets the receiver's message.

Parameters
string:String

the new message

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the text 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
setTextback to summary
public void setText(String string)

Sets the receiver's text.

Parameters
string:String

the new text

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the text 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
setVisibleback to summary
public void setVisible(boolean visible)

Marks the receiver as visible if the argument is true, and marks it invisible otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.

Parameters
visible:boolean

the new visibility state

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
timerProcback to summary
pack-priv long timerProc(long widget)

Overrides org.eclipse.swt.widgets.Widget.timerProc.

Annotations
@Override