title: ControlsFX 8.20.7 Wizard examples - getting Wizards to work
body: <p>I am trying to develop a wizard using the new ControlsFX 8.20.7 release. I have taken a look at the following example: <a href="https://bitbucket.org/controlsfx/controlsfx/src/8b76d20d7286b027e0953ab74118377f80db2f18/controlsfx-samples/src/main/java/org/controlsfx/samples/dialogs/HelloNewDialog.java?at=default#cl-496" rel="nofollow">BitBucket ControlsFX</a>, and especially the method </p>
  
  <pre><code>showLinearWizard() 
  </code></pre>
  
  <p>I simply can't understand how to use this API, can anyone help me get going or link to some examples?</p>
  
  <p>This is my code right now, full of errors:</p>
  
  <pre><code>public class WizardTest extends Application {
  
  private final ComboBox&lt;StageStyle&gt; styleCombobox = new ComboBox&lt;&gt;();
  private final ComboBox&lt;Modality&gt; modalityCombobox = new ComboBox&lt;&gt;();
  private final CheckBox cbUseBlocking = new CheckBox();
  private final CheckBox cbCloseDialogAutomatically = new CheckBox();
  private final CheckBox cbShowMasthead = new CheckBox();
  private final CheckBox cbSetOwner = new CheckBox();
  private final CheckBox cbCustomGraphic = new CheckBox();
  
  private Stage stage;
  
  @Override
  public void start(Stage primaryStage) {
      Button btn = new Button();
      btn.setText("Say 'Hello World'");
      btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
  
          @Override
          public void handle(ActionEvent event) {
              showLinearWizard();
          }
      });
  
      StackPane root = new StackPane();
      root.getChildren().add(btn);
  
      Scene scene = new Scene(root, 300, 250);
  
      primaryStage.setTitle("Hello World!");
      primaryStage.setScene(scene);
      primaryStage.show();
  
  }
  
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
      launch(args);
  
  }
  
  private void showLinearWizard() {
      // define pages to show
  
      Wizard wizard = new Wizard();
      wizard.setTitle("Linear Wizard");
  
      // --- page 1
      int row = 0;
  
      GridPane page1Grid = new GridPane();
      page1Grid.setVgap(10);
      page1Grid.setHgap(10);
  
      page1Grid.add(new Label("First Name:"), 0, row);
      TextField txFirstName = createTextField("firstName");
      wizard.getValidationSupport().registerValidator(txFirstName, Validator.createEmptyValidator("First Name is mandatory"));  
      page1Grid.add(txFirstName, 1, row++);
  
      page1Grid.add(new Label("Last Name:"), 0, row);
      TextField txLastName = createTextField("lastName");
     wizard.getValidationSupport().registerValidator(txLastName, Validator.createEmptyValidator("Last Name is mandatory"));
      page1Grid.add(txLastName, 1, row);
  
      WizardPane page1 = new WizardPane();
      page1.setHeaderText("Please Enter Your Details");
      page1.setContent(page1Grid);
  
      // --- page 2
      final WizardPane page2 = new WizardPane() {
          @Override
          public void onEnteringPage(Wizard wizard) {
              String firstName = (String) wizard.getSettings().get("firstName");
              String lastName = (String) wizard.getSettings().get("lastName");
  
              setContentText("Welcome, " + firstName + " " + lastName + "! Let's add some newlines!\n\n\n\n\n\n\nHello World!");
          }
      };
      page2.setHeaderText("Thanks For Your Details!");
  
      // --- page 3
      WizardPane page3 = new WizardPane();
      page3.setHeaderText("Goodbye!");
      page3.setContentText("Page 3, with extra 'help' button!");
  
      ButtonType helpDialogButton = new ButtonType("Help", ButtonData.HELP_2);
      page3.getButtonTypes().add(helpDialogButton);
      Button helpButton = (Button) page3.lookupButton(helpDialogButton);
      helpButton.addEventFilter(ActionEvent.ACTION, actionEvent -&gt; {
          actionEvent.consume(); // stop hello.dialog from closing
          System.out.println("Help clicked!");
      });
  
      // create wizard
      wizard.setFlow(new LinearFlow(page1, page2, page3));
  
      System.out.println("page1: " + page1);
      System.out.println("page2: " + page2);
      System.out.println("page3: " + page3);
  
      // show wizard and wait for response
      wizard.showAndWait().ifPresent(result -&gt; {
          if (result == ButtonType.FINISH) {
              System.out.println("Wizard finished, settings: " + wizard.getSettings());
          }
      });
  }
  
  private TextField createTextField(String id) {
      TextField textField = new TextField();
      textField.setId(id);
      GridPane.setHgrow(textField, Priority.ALWAYS);
      return textField;
  }
  
  }
  </code></pre>