1  import javafx.application.Application;
  2  import javafx.geometry.Insets;
  3  import javafx.scene.Scene;
  4  import javafx.scene.control.Label;
  5  import javafx.scene.control.TextField;
  6  import javafx.scene.layout.FlowPane;
  7  import javafx.stage.Stage;
  8  
  9  public class ShowFlowPane extends Application {
 10    @Override // Override the start method in the Application class
 11    public void start(Stage primaryStage) {
 12      // Create a pane and set its properties
 13      FlowPane pane = new FlowPane();
 14      pane.setPadding(new Insets(11, 12, 13, 14));
 15      pane.setHgap(5); // Set hGap to 5px
 16      pane.setVgap(5);
 17  
 18      // Place nodes in the pane
 19      pane.getChildren().addAll(new Label("First Name:"), 
 20        new TextField(), new Label("MI:"));
 21      TextField tfMi = new TextField();
 22      tfMi.setPrefColumnCount(1);
 23      pane.getChildren().addAll(tfMi, new Label("Last Name:"),
 24        new TextField());
 25      
 26      // Create a scene and place it in the stage
 27      Scene scene = new Scene(pane, 200, 250);
 28      primaryStage.setTitle("ShowFlowPane"); // Set the stage title
 29      primaryStage.setScene(scene); // Place the scene in the stage
 30      primaryStage.show(); // Display the stage
 31    }
 32    
 33    /**
 34     * The main method is only needed for the IDE with limited
 35     * JavaFX support. Not needed for running from the command line.
 36     */
 37    public static void main(String[] args) {
 38      launch(args);
 39    }
 40  }