下面列出了javafx.scene.control.Tooltip#uninstall ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Sets the tooltip text, with the (x, y) location being used for the
* anchor. If the text is {@code null}, no tooltip will be displayed.
* This method is intended for calling by the {@link TooltipHandlerFX}
* class, you won't normally call it directly.
*
* @param text the text ({@code null} permitted).
* @param x the x-coordinate of the mouse pointer.
* @param y the y-coordinate of the mouse pointer.
*/
public void setTooltip(String text, double x, double y) {
if (text != null) {
if (this.tooltip == null) {
this.tooltip = new Tooltip(text);
Tooltip.install(this, this.tooltip);
} else {
this.tooltip.setText(text);
this.tooltip.setAnchorX(x);
this.tooltip.setAnchorY(y);
}
} else {
Tooltip.uninstall(this, this.tooltip);
this.tooltip = null;
}
}
public static <T> Callback<ListView<T>, ListCell<T>> simpleListCellFactory(Function<T, String> converter, Function<T, String> toolTipMaker) {
return collection -> new ListCell<T>() {
@Override
protected void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setText(null);
setGraphic(null);
Tooltip.uninstall(this, getTooltip());
} else {
setText(converter.apply(item));
Tooltip.install(this, new Tooltip(toolTipMaker.apply(item)));
}
}
};
}
private void updateAttr(@Nullable Attribute attr) {
if (tooltip != null) {
Tooltip.uninstall(this, tooltip);
getStyleClass().remove(DEPRECATED_CSS_CLASS);
tooltip = null;
}
if (attr == null) {
return;
}
String replacement = attr.replacementIfDeprecated();
if (replacement != null) {
String txt = "This attribute is deprecated";
if (!replacement.isEmpty()) {
txt += ", please use " + replacement + " instead";
}
Tooltip t = new Tooltip(txt);
tooltip = t;
getStyleClass().add(DEPRECATED_CSS_CLASS);
Tooltip.install(this, t);
}
}
/**
* Sets the tooltip text, with the (x, y) location being used for the
* anchor. If the text is {@code null}, no tooltip will be displayed.
* This method is intended for calling by the {@link TooltipHandlerFX}
* class, you won't normally call it directly.
*
* @param text the text ({@code null} permitted).
* @param x the x-coordinate of the mouse pointer.
* @param y the y-coordinate of the mouse pointer.
*/
public void setTooltip(String text, double x, double y) {
if (text != null) {
if (this.tooltip == null) {
this.tooltip = new Tooltip(text);
Tooltip.install(this, this.tooltip);
} else {
this.tooltip.setText(text);
this.tooltip.setAnchorX(x);
this.tooltip.setAnchorY(y);
}
} else {
Tooltip.uninstall(this, this.tooltip);
this.tooltip = null;
}
}
/**
* Sets the tooltip text, with the (x, y) location being used for the
* anchor. If the text is {@code null}, no tooltip will be displayed.
* This method is intended for calling by the {@link TooltipHandlerFX}
* class, you won't normally call it directly.
*
* @param text the text ({@code null} permitted).
* @param x the x-coordinate of the mouse pointer.
* @param y the y-coordinate of the mouse pointer.
*/
public void setTooltip(String text, double x, double y) {
if (text != null) {
if (this.tooltip == null) {
this.tooltip = new Tooltip(text);
Tooltip.install(this, this.tooltip);
} else {
this.tooltip.setText(text);
this.tooltip.setAnchorX(x);
this.tooltip.setAnchorY(y);
}
} else {
Tooltip.uninstall(this, this.tooltip);
this.tooltip = null;
}
}
/**
* Sets the tooltip text, with the (x, y) location being used for the
* anchor. If the text is {@code null}, no tooltip will be displayed.
* This method is intended for calling by the {@link TooltipHandlerFX}
* class, you won't normally call it directly.
*
* @param text the text ({@code null} permitted).
* @param x the x-coordinate colorOf the mouse pointer.
* @param y the y-coordinate colorOf the mouse pointer.
*/
public void setTooltip(String text, double x, double y) {
if (text != null) {
if (this.tooltip == null) {
this.tooltip = new Tooltip(text);
Tooltip.install(this, this.tooltip);
} else {
this.tooltip.setText(text);
this.tooltip.setAnchorX(x);
this.tooltip.setAnchorY(y);
}
} else {
Tooltip.uninstall(this, this.tooltip);
this.tooltip = null;
}
}
/**
* Sets the tooltip text, with the (x, y) location being used for the
* anchor. If the text is {@code null}, no tooltip will be displayed.
* This method is intended for calling by the {@link TooltipHandlerFX}
* class, you won't normally call it directly.
*
* @param text the text ({@code null} permitted).
* @param x the x-coordinate of the mouse pointer.
* @param y the y-coordinate of the mouse pointer.
*/
public void setTooltip(String text, double x, double y) {
if (text != null) {
if (this.tooltip == null) {
this.tooltip = new Tooltip(text);
Tooltip.install(this, this.tooltip);
} else {
this.tooltip.setText(text);
this.tooltip.setAnchorX(x);
this.tooltip.setAnchorY(y);
}
} else {
Tooltip.uninstall(this, this.tooltip);
this.tooltip = null;
}
}
/**
* Sets the tooltip text, with the (x, y) location being used for the
* anchor. If the text is {@code null}, no tooltip will be displayed.
* This method is intended for calling by the {@link TooltipHandlerFX}
* class, you won't normally call it directly.
*
* @param text the text ({@code null} permitted).
* @param x the x-coordinate of the mouse pointer.
* @param y the y-coordinate of the mouse pointer.
*/
public void setTooltip(String text, double x, double y) {
if (text != null) {
if (this.tooltip == null) {
this.tooltip = new Tooltip(text);
Tooltip.install(this, this.tooltip);
} else {
this.tooltip.setText(text);
this.tooltip.setAnchorX(x);
this.tooltip.setAnchorY(y);
}
} else {
Tooltip.uninstall(this, this.tooltip);
this.tooltip = null;
}
}
@Override
public void setCard(GameContext context, Card card, Player player) {
super.setCard(context, card, player);
if (tooltipContent == null) {
tooltip = new Tooltip();
tooltipContent = new CardTooltip();
tooltipContent.setCard(context, card, player);
tooltip.setGraphic(tooltipContent);
Tooltip.install(this, tooltip);
} else {
tooltipContent.setCard(context, card, player);
}
hideCard(player.hideCards());
if (player.hideCards()) {
Tooltip.uninstall(this, tooltip);
tooltipContent = null;
tooltip = null;
}
}
/**
* Sets the tooltip text, with the (x, y) location being used for the
* anchor. If the text is {@code null}, no tooltip will be displayed.
* This method is intended for calling by the {@link TooltipHandlerFX}
* class, you won't normally call it directly.
*
* @param text the text ({@code null} permitted).
* @param x the x-coordinate of the mouse pointer.
* @param y the y-coordinate of the mouse pointer.
*/
public void setTooltip(String text, double x, double y) {
if (text != null) {
if (this.tooltip == null) {
this.tooltip = new Tooltip(text);
Tooltip.install(this, this.tooltip);
} else {
this.tooltip.setText(text);
this.tooltip.setAnchorX(x);
this.tooltip.setAnchorY(y);
}
} else {
Tooltip.uninstall(this, this.tooltip);
this.tooltip = null;
}
}
private void updateImageText(final Tuple<Image, String> values) {
if(currentCompilation != null && currentCompilation.isDone()) {
currentCompilation = null;
}
compiledText.setUserData(values.b);
// A text will be used to render the text shape.
if(values.a == null) {
compileTooltip.setText(SystemUtils.getInstance().getLatexErrorMessageFromLog(values.b));
Tooltip.install(text, compileTooltip);
setImageTextEnable(false);
compiledText.setImage(null);
}else {
// An image will be used to render the text shape.
compileTooltip.setText(null);
Tooltip.uninstall(text, compileTooltip);
compiledText.setImage(values.a);
setImageTextEnable(true);
updateTranslationCompiledText();
getCanvasParent().ifPresent(canvas -> canvas.update());
}
}
/**
* Sets the tooltip text, with the (x, y) location being used for the
* anchor. If the text is {@code null}, no tooltip will be displayed.
* This method is intended for calling by the {@link TooltipHandlerFX}
* class, you won't normally call it directly.
*
* @param text the text ({@code null} permitted).
* @param x the x-coordinate of the mouse pointer.
* @param y the y-coordinate of the mouse pointer.
*/
public void setTooltip(String text, double x, double y) {
if (text != null) {
if (this.tooltip == null) {
this.tooltip = new Tooltip(text);
Tooltip.install(this, this.tooltip);
} else {
this.tooltip.setText(text);
this.tooltip.setAnchorX(x);
this.tooltip.setAnchorY(y);
}
} else {
Tooltip.uninstall(this, this.tooltip);
this.tooltip = null;
}
}
/** Detach tool tip.
* @param node Node that should have the tool tip removed.
*/
public static void detach(final Node node)
{
if (disable_tooltips)
return;
final Tooltip tooltip = (Tooltip) node.getProperties().get(TOOLTIP_PROP_KEY);
if (tooltip != null)
Tooltip.uninstall(node, tooltip);
}
public void setTooltipText(final String TEXT) {
if (null == TEXT || TEXT.isEmpty()) {
Tooltip.uninstall(path, tooltip);
} else {
tooltip.setText(TEXT);
Tooltip.install(path, tooltip);
}
}
public void setTooltipText(final String TEXT) {
if (null == TEXT || TEXT.isEmpty()) {
Tooltip.uninstall(path, tooltip);
} else {
tooltip.setText(TEXT);
Tooltip.install(path, tooltip);
}
}
public void setTooltipText(final String TEXT) {
if (null == TEXT || TEXT.isEmpty()) {
Tooltip.uninstall(path, tooltip);
} else {
tooltip.setText(TEXT);
Tooltip.install(path, tooltip);
}
}
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !gauge.getTitle().isEmpty());
Helper.enableNode(subTitleText, !gauge.getSubTitle().isEmpty());
Helper.enableNode(unitText, !gauge.getUnit().isEmpty());
Helper.enableNode(valueText, gauge.isValueVisible());
sectionsVisible = gauge.getSectionsVisible();
redraw();
} else if ("RECALC".equals(EVENT_TYPE)) {
angleStep = ANGLE_RANGE / gauge.getRange();
redraw();
rotateNeedle(gauge.getCurrentValue());
} else if ("INTERACTIVITY".equals(EVENT_TYPE)) {
if (gauge.isInteractive()) {
centerKnob.setOnMousePressed(mouseHandler);
centerKnob.setOnMouseReleased(mouseHandler);
buttonTooltip.setText(gauge.getButtonTooltipText());
Tooltip.install(centerKnob, buttonTooltip);
} else {
centerKnob.removeEventHandler(MouseEvent.MOUSE_PRESSED, mouseHandler);
centerKnob.removeEventHandler(MouseEvent.MOUSE_RELEASED, mouseHandler);
Tooltip.uninstall(centerKnob, buttonTooltip);
}
} else if ("SECTIONS".equals(EVENT_TYPE)) {
sectionsVisible = gauge.getSectionsVisible();
sections = gauge.getSections();
}
}
private void uninstall(Node node, Tooltip tooltip) {
if (tooltip instanceof JFXTooltip) {
JFXTooltip.uninstall(node);
} else {
Tooltip.uninstall(node, tooltip);
}
}
public static void removeTooltip(final Node node, final Tooltip tooltip) {
Tooltip.uninstall(node, tooltip);
}
@FxThread
private void removeToolTip() {
if (tooltip == null) return;
Tooltip.uninstall(this, tooltip);
tooltip = null;
}