Java Tooltip.install(Node node, Tooltip t)

Syntax

Tooltip.install(Node node, Tooltip t) has the following syntax.

public static void install(Node node,
  Tooltip t)

Example

In the following code shows how to use Tooltip.install(Node node, Tooltip t) method.


/*from  ww w  .  jav a 2 s  .co m*/

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Tooltip;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;


public class Main extends Application {
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        stage.setTitle("Tooltip Sample");
        stage.setWidth(300);
        stage.setHeight(150);

        Rectangle rect = new Rectangle(0, 0, 100, 100);
        Tooltip t = new Tooltip("A Square");
        Tooltip.install(rect, t);
        
        ((Group) scene.getRoot()).getChildren().add(rect);

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




















Home »
  Java Tutorial »
    javafx.scene.control »




Accordion
Button
CheckBox
CheckMenuItem
ChoiceBox
ComboBox
ContextMenu
Label
Menu
ProgressBar
ToggleButton
ToolBar
Tooltip
TreeItem
TreeView