document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import javafx.application.Application;
  2. import javafx.geometry.Insets;
  3. import javafx.scene.Scene;
  4. import javafx.scene.control.Button;
  5. import javafx.scene.layout.TilePane;
  6. import javafx.stage.Stage;
  7.  
  8. /**
  9.  *
  10.  * @web http://zoranpavlovic.blogspot.com/
  11.  */
  12. public class TilePaneMain extends Application {
  13.  
  14.     /**
  15.      * @param args
  16.      *            the command line arguments
  17.      */
  18.     public static void main(String[] args) {
  19.         launch(args);
  20.     }
  21.  
  22.     @Override
  23.     public void start(Stage primaryStage) {
  24.         primaryStage.setTitle("TilePane");
  25.  
  26.         // Adding TilePane
  27.         TilePane tilePane = new TilePane();
  28.         tilePane.setPadding(new Insets(10, 10, 10, 10));
  29.         tilePane.setVgap(4);
  30.         tilePane.setHgap(4);
  31.        
  32.         Button btn = new Button();
  33.  
  34.         for (int i = 0; i < 8; i++) {
  35.  
  36.             btn = new Button("Button");
  37.             btn.setPrefSize(100, 50);
  38.             tilePane.getChildren().add(btn);
  39.  
  40.         }
  41.  
  42.         // Adding TilePane to the scene
  43.         Scene scene = new Scene(tilePane);
  44.         primaryStage.setScene(scene);
  45.         primaryStage.show();
  46.     }
  47. }
');