Example usage for javafx.scene.control Tooltip uninstall

List of usage examples for javafx.scene.control Tooltip uninstall

Introduction

In this page you can find the example usage for javafx.scene.control Tooltip uninstall.

Prototype

public static void uninstall(Node node, Tooltip t) 

Source Link

Document

Removes the association of the given Tooltip on the specified Node .

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//w ww.j a va 2  s .co  m
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");

    toolTip.setWrapText(true);

    button.setTooltip(toolTip);

    Tooltip.uninstall(button, toolTip);

    ((Group) scene.getRoot()).getChildren().add(button);

    stage.setScene(scene);
    stage.show();
}

From source file:de.hs.mannheim.modUro.controller.diagram.fx.ChartCanvas.java

/**
 * 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.
 * /*from   w ww.j  av  a 2s .  c  o m*/
 * @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;
    }
}

From source file:ambroafb.general.AnnotiationUtils.java

private static void changeNodeTitleLabelVisual(Node node, String explain) {
    Parent parent = node.getParent();//from   www  . j  a v a2 s  .  c o  m
    Label nodeTitleLabel = (Label) parent.lookup(".validationMessage");

    if (explain.isEmpty()) {
        if (default_colors_map.containsKey(nodeTitleLabel)) {// This order of 'if' statements is correct!
            nodeTitleLabel.setTextFill(default_colors_map.get(nodeTitleLabel));
            default_colors_map.remove(nodeTitleLabel);
            Tooltip.uninstall(nodeTitleLabel, toolTip);
        }
    } else {
        node.requestFocus();
        toolTip.setText(GeneralConfig.getInstance().getTitleFor(explain));
        toolTip.setStyle("-fx-background-color: gray; -fx-font-size: 8pt;");
        Tooltip.install(nodeTitleLabel, toolTip);
        default_colors_map.putIfAbsent(nodeTitleLabel, nodeTitleLabel.getTextFill());
        nodeTitleLabel.setTextFill(Color.RED);
    }
}

From source file:net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil.java

public static <T> Callback<ListView<T>, ListCell<T>> simpleListCellFactory(Function<T, String> converter,
        Function<T, String> toolTipMaker) {
    return collection -> new ListCell<T>() {
        @Override//from w ww .ja  va2 s . co m
        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)));
            }
        }
    };
}

From source file:org.sleuthkit.autopsy.timeline.ui.detailview.EventNodeBase.java

EventNodeBase(Type tlEvent, EventNodeBase<?> parent, DetailsChartLane<?> chartLane) {
    this.chartLane = chartLane;
    this.tlEvent = tlEvent;
    this.parentNode = parent;

    sleuthkitCase = chartLane.getController().getAutopsyCase().getSleuthkitCase();
    eventsModel = chartLane.getController().getEventsModel();
    eventTypeImageView.setImage(getEventType().getFXImage());

    if (tlEvent.getEventIDsWithHashHits().isEmpty()) {
        show(hashIV, false);//w w w .  java 2s. co m
    }

    if (tlEvent.getEventIDsWithTags().isEmpty()) {
        show(tagIV, false);
    }

    if (chartLane.getController().getEventsModel().getEventTypeZoom() == EventTypeZoomLevel.SUB_TYPE) {
        evtColor = getEventType().getColor();
    } else {
        evtColor = getEventType().getBaseType().getColor();
    }
    SELECTION_BORDER = new Border(new BorderStroke(evtColor.darker().desaturate(), BorderStrokeStyle.SOLID,
            CORNER_RADII_3, new BorderWidths(2)));

    defaultBackground = new Background(
            new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII_3, Insets.EMPTY));
    highlightedBackground = new Background(
            new BackgroundFill(evtColor.deriveColor(0, 1.1, 1.1, .3), CORNER_RADII_3, Insets.EMPTY));
    setBackground(defaultBackground);

    Tooltip.install(this, this.tooltip);

    //set up mouse hover effect and tooltip
    setOnMouseEntered(mouseEntered -> {
        Tooltip.uninstall(chartLane, AbstractTimelineChart.getDefaultTooltip());
        showHoverControls(true);
        toFront();
    });
    setOnMouseExited(mouseExited -> {
        showHoverControls(false);
        if (parentNode != null) {
            parentNode.showHoverControls(true);
        } else {
            Tooltip.install(chartLane, AbstractTimelineChart.getDefaultTooltip());
        }
    });
    setOnMouseClicked(new ClickHandler());
    show(controlsHBox, false);
}

From source file:org.sleuthkit.autopsy.timeline.ui.detailview.EventNodeBase.java

void enableTooltip(boolean toolTipEnabled) {
    if (toolTipEnabled) {
        Tooltip.install(this, tooltip);
    } else {/*from w ww  .  ja v a2s  .c o  m*/
        Tooltip.uninstall(this, tooltip);
    }
}