O'Reilly logo

Java 11 Cookbook by Mohamed Sanaulla, Nick Samoylov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

  1. Create a simple class, RobotApplication that extends javafx.application.Application and sets up the UI required for testing the Robot API and also creates an instance of javafx.scene.robot.Robot. This class will be defined as a static inner class to the RobotAPIDemo main class :
public static class RobotApplication extends Application{  @Override  public void start(Stage stage) throws Exception{    robot = new Robot();    GridPane gridPane = new GridPane();    gridPane.setAlignment(Pos.CENTER);    gridPane.setHgap(10);    gridPane.setVgap(10);    gridPane.setPadding(new Insets(25, 25, 25, 25));    Text appTitle = new Text("Robot Demo");    appTitle.setFont(Font.font("Arial",         FontWeight.NORMAL, 15));    gridPane.add(appTitle, 0, 0, 2, 1); Label nameLbl ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required