Check out example codes for "tooltip lambda javafx". It will help you in understanding the concepts better.

Code Example 1

final PasswordField pf = new PasswordField();
final Tooltip tooltip = new Tooltip();
tooltip.setText(
    "\nYour password must be\n" +
    "at least 8 characters in length\n"  +
);
pf.setTooltip(tooltip);

Code Example 2

import javafx.scene.control.Tooltip;
 import javafx.scene.control.Button;

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

Learn ReactJs, React Native from akashmittal.com