package javafx_tilepane; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.image.ImageView; import javafx.scene.layout.TilePane; import javafx.stage.Stage; /** * * @web http://java-buddy.blogspot.com/ */ public class JavaFX_TilePane extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("java-buddy.blogspot.com"); TilePane horizontalTile = new TilePane(); horizontalTile.setHgap(8); horizontalTile.setPrefColumns(4); for (int i = 0; i < 20; i++) { horizontalTile.getChildren().add(new ImageView("http://goo.gl/kYEQl")); } primaryStage.setScene(new Scene(horizontalTile, 450, 450)); primaryStage.show(); } }
Related:
- TilePane in vertical
- Create TilePane using FXML
No comments:
Post a Comment