public class FlowPaneDemo extends Application
1: import javafx.application.Application;
2: import javafx.scene.Scene;
3: import javafx.stage.Stage;
4: import javafx.scene.layout.FlowPane;
5: import javafx.scene.control.Button;
6: /**
7: Simple demonstration of adding buttons to the FlowPane layout.
8: */
9: public class FlowPaneDemo extends Application
10: {
11: public static void main(String[] args)
12: {
13: launch(args);
14: }
15:
16: @Override
17: public void start(Stage primaryStage) throws Exception
18: {
19: FlowPane root = new FlowPane();
20:
21: // Set a gap of 5 pixels vertically and horizontally
22: // between buttons
23: root.setVgap(5);
24: root.setHgap(5);
25:
26: root.getChildren().add(new Button("This is Button 1"));
27: root.getChildren().add(new Button("This is Button 2"));
28: root.getChildren().add(new Button("This is Button 3"));
29:
30:
31: Scene scene = new Scene(root, 500, 200);
32: primaryStage.setTitle("FlowPane Demo");
33: primaryStage.setScene(scene);
34: primaryStage.show();
35: }
36: }