
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.stage.PopupWindow.AnchorLocation;
import javafx.stage.Stage;
 
public class ToolTipTest  extends Application {
 
   @Override
   public void start(Stage stage) {
 
       GridPane root= new GridPane();
       root.setHgap(5);
       root.setVgap(5);
       root.setPadding(new Insets(5));
      
       // User Name
       root.add(new Label("User Name"), 0, 0);
       TextField field_userName= new TextField();
       root.add(field_userName, 1, 0);
      
       WebTooltip tooltip_userName=new WebTooltip("Enter user name");
       field_userName.setTooltip(tooltip_userName);
      
      
       // Password
       root.add(new Label("Password"), 0, 1);
       PasswordField field_password= new PasswordField();
      
       WebTooltip tooltip_password=new WebTooltip("Enter Password");
       field_password.setTooltip(tooltip_password);
      
       root.add(field_password, 1, 1);
      
      
       // Create a Button
       Button button_login = new Button("Submit");
       WebTooltip tooltip_login =new WebTooltip("Login to Application");
      
       // Set Location to display tooltip.
       tooltip_login.setAnchorLocation(AnchorLocation.WINDOW_BOTTOM_LEFT);
       button_login.setTooltip(tooltip_login);
      
      
       root.add(button_login, 1, 2);      
        
      
      
       Scene scene = new Scene(root, 350, 200);        
 
       stage.setTitle(System.getProperty("java.runtime.version"));
       stage.setScene(scene);
       stage.show();
   }
 
   public static void main(String[] args) {
       Application.launch(args);
   }
  
}
