Skip to content

Tooltips

weisj edited this page May 19, 2020 · 7 revisions

Tooltip API

The ToolTipContext class provides functionality to control tooltip position. This way tooltips with an anchored balloon like appearance are possible.

Darklaf provides a default context for any component that specifies its ToolTipConstants.KEY_STYLE value as ToolTipConstants.STYLE_BALOON (see Properties/JToolTip).

The default context will align the tooltip centred to the bottom edge of the component respecting the border insets. If the tooltip doesn't fit inside the current frame the position is based on whether it can be fit inside the current screen.

You can use a custom context by providing it through ToolTipConstants.KEY_CONTEXT property in combination with ToolTipConstants.KEY_STYLE = ToolTipConstants.STYLE_BALOON.

By default, buttons specify the ToolTipConstants.STYLE_BALOON style.

Examples

####setAlignInside(boolean) setAlignInside(true):

setAlignInside(false):

####setToolTipInsets(Insets)

####setIgnoreBorder(boolean)

####setUseBestFot(boolean)

####setToolTipRectSupplier(Function<MouseEvent, Rectangle>):

####setApplyComponentInsetsToRect(boolean):

####setInsideArea(Area) & setInsideArea(Rectangle)

####setHideOnExit(boolean): setHideOnExit(false):

setHideOnExit(true):

See: ToolTipContext, ToolTipDemo

Clone this wiki locally