Source of ShowFlowPane.java


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