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.TilePane;
- import javafx.stage.Stage;
- /**
- *
- * @web http://zoranpavlovic.blogspot.com/
- */
- public class TilePaneMain extends Application {
- /**
- * @param args
- * the command line arguments
- */
- public static void main(String[] args) {
- launch(args);
- }
- @Override
- public void start(Stage primaryStage) {
- primaryStage.setTitle("TilePane");
- // Adding TilePane
- TilePane tilePane = new TilePane();
- tilePane.setPadding(new Insets(10, 10, 10, 10));
- tilePane.setVgap(4);
- tilePane.setHgap(4);
- Button btn = new Button();
- for (int i = 0; i < 8; i++) {
- btn = new Button("Button");
- btn.setPrefSize(100, 50);
- tilePane.getChildren().add(btn);
- }
- // Adding TilePane to the scene
- Scene scene = new Scene(tilePane);
- primaryStage.setScene(scene);
- primaryStage.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement