Spec-Zone .ru
спецификации, руководства, описания, API
|
public class Tooltip extends PopupControl
The Tooltip has two different states: activated and visible. The Skin observes these two states and reacts accordingly, e.g starts timers, shows or hides the tooltip which may be implemented as a popup. The example below shows how to create a tooltip for a Button control,
import javafx.scene.control.Tooltip; import javafx.scene.control.Button; Button button = new Button("Hover Over Me"); button.setTooltip(new Tooltip("Tooltip for Button"));You can also use tooltip with any node, though not quite as conveniently as with controls.
Rectangle rect = new Rectangle(0, 0, 100, 100); Tooltip t = new Tooltip("A Square"); Tooltip.install(rect, t);This tooltip with then participate in the typical tooltip semantics. Note that the Tooltip does not have to be uninstalled, it will be garbage collected when no more nodes reference it, or when all nodes that reference it are also garbage collected. It is possible to manually uninstall the tooltip, however. A single tooltip can be installed on multiple target nodes or multiple controls.
Type | Property and Description |
---|---|
ReadOnlyBooleanProperty |
activated
Typically, the tooltip is "activated" when the mouse moves over a Control.
|
ObjectProperty<ContentDisplay> |
contentDisplay
Specifies the positioning of the graphic relative to the text.
|
ObjectProperty<Font> |
font
The default font to use for text in the Tooltip.
|
ObjectProperty<Node> |
graphic
An optional icon for the Tooltip.
|
DoubleProperty |
graphicTextGap
The amount of space between the graphic and text
|
ObjectProperty<TextAlignment> |
textAlignment
Specifies the behavior for lines of text when text is multiline
Unlike
contentDisplay which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds. |
ObjectProperty<OverrunStyle> |
textOverrun
Specifies the behavior to use if the text of the
Tooltip
exceeds the available space for rendering the text. |
StringProperty |
text
The text to display in the tooltip.
|
BooleanProperty |
wrapText
If a run of text exceeds the width of the Tooltip, then this variable
indicates whether the text should wrap onto another line.
|
idProperty, maxHeightProperty, maxWidthProperty, minHeightProperty, minWidthProperty, prefHeightProperty, prefWidthProperty, skinProperty, styleProperty
autoFixProperty, autoHideProperty, hideOnEscapeProperty, onAutoHideProperty, ownerNodeProperty, ownerWindowProperty
eventDispatcherProperty, focusedProperty, heightProperty, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, sceneProperty, showingProperty, widthProperty, xProperty, yProperty
USE_COMPUTED_SIZE, USE_PREF_SIZE
Constructor and Description |
---|
Tooltip()
Creates a tooltip with an empty string for its text.
|
Tooltip(java.lang.String text)
Creates a tooltip with the specified text.
|
Modifier and Type | Method and Description |
---|---|
ReadOnlyBooleanProperty |
activatedProperty()
Typically, the tooltip is "activated" when the mouse moves over a Control.
|
ObjectProperty<ContentDisplay> |
contentDisplayProperty()
Specifies the positioning of the graphic relative to the text.
|
ObjectProperty<Font> |
fontProperty()
The default font to use for text in the Tooltip.
|
ContentDisplay |
getContentDisplay()
Specifies the positioning of the graphic relative to the text.
|
Font |
getFont()
The default font to use for text in the Tooltip.
|
Node |
getGraphic()
An optional icon for the Tooltip.
|
double |
getGraphicTextGap()
The amount of space between the graphic and text
|
java.lang.String |
getText()
The text to display in the tooltip.
|
TextAlignment |
getTextAlignment()
Specifies the behavior for lines of text when text is multiline
Unlike
contentDisplay which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds. |
OverrunStyle |
getTextOverrun()
Specifies the behavior to use if the text of the
Tooltip
exceeds the available space for rendering the text. |
ObjectProperty<Node> |
graphicProperty()
An optional icon for the Tooltip.
|
DoubleProperty |
graphicTextGapProperty()
The amount of space between the graphic and text
|
static void |
install(Node node,
Tooltip t)
|
boolean |
isActivated()
Typically, the tooltip is "activated" when the mouse moves over a Control.
|
boolean |
isWrapText()
If a run of text exceeds the width of the Tooltip, then this variable
indicates whether the text should wrap onto another line.
|
void |
setContentDisplay(ContentDisplay value)
Specifies the positioning of the graphic relative to the text.
|
void |
setFont(Font value)
The default font to use for text in the Tooltip.
|
void |
setGraphic(Node value)
An optional icon for the Tooltip.
|
void |
setGraphicTextGap(double value)
The amount of space between the graphic and text
|
void |
setText(java.lang.String value)
The text to display in the tooltip.
|
void |
setTextAlignment(TextAlignment value)
Specifies the behavior for lines of text when text is multiline
Unlike
contentDisplay which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds. |
void |
setTextOverrun(OverrunStyle value)
Specifies the behavior to use if the text of the
Tooltip
exceeds the available space for rendering the text. |
void |
setWrapText(boolean value)
If a run of text exceeds the width of the Tooltip, then this variable
indicates whether the text should wrap onto another line.
|
ObjectProperty<TextAlignment> |
textAlignmentProperty()
Specifies the behavior for lines of text when text is multiline
Unlike
contentDisplay which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds. |
ObjectProperty<OverrunStyle> |
textOverrunProperty()
Specifies the behavior to use if the text of the
Tooltip
exceeds the available space for rendering the text. |
StringProperty |
textProperty()
The text to display in the tooltip.
|
static void |
uninstall(Node node,
Tooltip t)
|
BooleanProperty |
wrapTextProperty()
If a run of text exceeds the width of the Tooltip, then this variable
indicates whether the text should wrap onto another line.
|
getId, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, getSkin, getStyle, getStyleClass, idProperty, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, setId, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setPrefHeight, setPrefSize, setPrefWidth, setSkin, setStyle, skinProperty, styleProperty
autoFixProperty, autoHideProperty, getOnAutoHide, getOwnerNode, getOwnerWindow, hide, hideOnEscapeProperty, isAutoFix, isAutoHide, isHideOnEscape, onAutoHideProperty, ownerNodeProperty, ownerWindowProperty, setAutoFix, setAutoHide, setHideOnEscape, setOnAutoHide, setScene, show, show, show
addEventFilter, addEventHandler, buildEventDispatchChain, centerOnScreen, eventDispatcherProperty, fireEvent, focusedProperty, getEventDispatcher, getHeight, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getOpacity, getScene, getWidth, getX, getY, heightProperty, isFocused, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, removeEventFilter, removeEventHandler, requestFocus, sceneProperty, setEventDispatcher, setEventHandler, setHeight, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setOpacity, setWidth, setX, setY, show, showingProperty, sizeToScene, widthProperty, xProperty, yProperty
getText()
,
setText(String)
contentDisplay
which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds.Tooltip
exceeds the available space for rendering the text.getTextOverrun()
,
setTextOverrun(OverrunStyle)
isWrapText()
,
setWrapText(boolean)
getFont()
,
setFont(Font)
contentDisplay
property.
The node specified for this variable cannot appear elsewhere in the
scene graph, otherwise the IllegalArgumentException
is thrown.
See the class description of Node
for more detail.getGraphic()
,
setGraphic(Node)
getGraphicTextGap()
,
setGraphicTextGap(double)
isActivated()
public Tooltip()
public Tooltip(java.lang.String text)
text
- A text string for the tooltip.public static void install(Node node, Tooltip t)
Tooltip
with the given Node
. The tooltip
can then behave similar to when it is set on any Control
. A single
tooltip can be associated with multiple nodes.Tooltip
public static void uninstall(Node node, Tooltip t)
Tooltip
on the specified
Node
. Hence hovering on the node will no longer result in showing of the
tooltip.Tooltip
public final StringProperty textProperty()
getText()
,
setText(String)
public final void setText(java.lang.String value)
public final java.lang.String getText()
public final void setTextAlignment(TextAlignment value)
contentDisplay
which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds.public final TextAlignment getTextAlignment()
contentDisplay
which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds.public final ObjectProperty<TextAlignment> textAlignmentProperty()
contentDisplay
which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds.public final void setTextOverrun(OverrunStyle value)
Tooltip
exceeds the available space for rendering the text.public final OverrunStyle getTextOverrun()
Tooltip
exceeds the available space for rendering the text.public final ObjectProperty<OverrunStyle> textOverrunProperty()
Tooltip
exceeds the available space for rendering the text.getTextOverrun()
,
setTextOverrun(OverrunStyle)
public final void setWrapText(boolean value)
public final boolean isWrapText()
public final BooleanProperty wrapTextProperty()
isWrapText()
,
setWrapText(boolean)
public final void setFont(Font value)
public final Font getFont()
public final ObjectProperty<Font> fontProperty()
getFont()
,
setFont(Font)
public final void setGraphic(Node value)
contentDisplay
property.
The node specified for this variable cannot appear elsewhere in the
scene graph, otherwise the IllegalArgumentException
is thrown.
See the class description of Node
for more detail.public final Node getGraphic()
contentDisplay
property.
The node specified for this variable cannot appear elsewhere in the
scene graph, otherwise the IllegalArgumentException
is thrown.
See the class description of Node
for more detail.public final ObjectProperty<Node> graphicProperty()
contentDisplay
property.
The node specified for this variable cannot appear elsewhere in the
scene graph, otherwise the IllegalArgumentException
is thrown.
See the class description of Node
for more detail.getGraphic()
,
setGraphic(Node)
public final void setContentDisplay(ContentDisplay value)
public final ContentDisplay getContentDisplay()
public final ObjectProperty<ContentDisplay> contentDisplayProperty()
public final void setGraphicTextGap(double value)
public final double getGraphicTextGap()
public final DoubleProperty graphicTextGapProperty()
getGraphicTextGap()
,
setGraphicTextGap(double)
public final boolean isActivated()
public final ReadOnlyBooleanProperty activatedProperty()
isActivated()
Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. Use is subject to