FlowPane_TilePane1 |
|
Code Snippet:
|
Codes:
package javafxtemplate1; import java.sql.SQLException; import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.FlowPane; import javafx.scene.layout.TilePane; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class JavaFXTemplate1 extends Application { Label caption = new Label(); @Override public void start(Stage primaryStage)throws SQLException { Scene scene = new Scene(new Group()); primaryStage.setTitle("Flow Pane & TilePane Array"); FlowPane flow = new FlowPane();// scenelayout package FlowPane TilePane tPane = new TilePane(); // scenelayout package TilePane flow.setVgap(8); flow.setHgap(4); tPane.setVgap(8); tPane.setHgap(4); flow.setPrefWrapLength(300); // Run alternate Flow and Tile for (int i = 0; i < 15; i++) { flow.getChildren().add(new Button("F-Button " +i)); // tPane.getChildren().add(new Button("T-Button " +i)); } //Sets the value of the property root. scene.setRoot(flow); // scene.setRoot(tPane); primaryStage.setScene(scene); // scene.getStylesheets().add //("http://manas9/BareBone_JavaCore/JavaFxCSS1.css"); //OR scene.getStylesheets().add(javafxtemplate1. JavaFXTemplate1.class.getResource ("JavaFxCSS1.css").toExternalForm()); primaryStage.show(); } public static void main(String[] args) throws SQLException { launch(args); } } |
Runtime View : A)TilePane:
B) FlowPane
|