import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.FlowPane; import javafx.scene.shape.Sphere; import javafx.stage.Stage; publicclassFlowPaneExampleextendsApplication { @Override publicvoidstart(Stage stage) { //Creating button1 Buttonbutton1=newButton("Button1"); //Creating button2 Buttonbutton2=newButton("Button2"); //Creating button3 Buttonbutton3=newButton("Button3"); //Creating button4 Buttonbutton4=newButton("Button4"); //Creating a Flow Pane FlowPaneflowPane=newFlowPane(); //Setting the horizontal gap between the nodes flowPane.setHgap(25); //Setting the margin of the pane flowPane.setMargin(button1, newInsets(20, 0, 20, 20)); //Retrieving the observable list of the flow Pane ObservableListlist= flowPane.getChildren(); //Adding all the nodes to the flow pane list.addAll(button1, button2, button3, button4); //Creating a scene object Scenescene=newScene(flowPane); //Setting title to the Stage stage.setTitle("Flow Pane Example"); //Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); } publicstaticvoidmain(String args[]){ launch(args); } }