Example usage for javafx.scene.control Tooltip setGraphic

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

Introduction

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

Prototype

public final void setGraphic(Node value) 

Source Link

Usage

From source file:Main.java

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

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");
    Node icon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    toolTip.setGraphic(icon);

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

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