Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javafx.application.Application;
- import javafx.geometry.Insets;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.layout.FlowPane;
- import javafx.stage.Stage;
- /**
- *
- * @web http://zoranpavlovic.blogspot.com/
- */
- public class FlowPaneMain extends Application {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- launch(args);
- }
- @Override
- public void start(Stage primaryStage) {
- primaryStage.setTitle("FlowPane example");
- //Adding FlowPane
- FlowPane flowPane = new FlowPane();
- flowPane.setPadding(new Insets(10, 10, 10,10));
- flowPane.setVgap(4);
- flowPane.setHgap(4);
- // preferred width allows for two columns
- flowPane.setPrefWrapLength(210);
- Button btn = new Button();
- for(int i=0; i<8; i++){
- btn = new Button("Button");
- btn.setPrefSize(100, 50);
- flowPane.getChildren().add(btn);
- }
- //Adding FlowPane to the scene
- Scene scene = new Scene(flowPane);
- primaryStage.setScene(scene);
- primaryStage.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement