StackPane_FlowPane1 |
Code :
package javafxtemplate2; import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Orientation; import javafx.geometry.Pos; import javafx.scene.*; import javafx.scene.control.Label; import javafx.scene.layout.FlowPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; import javafx.scene.layout.TilePane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Line; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; /** * * @author Manas9 */ public class JavaFXTemplate2 extends Application { @Override public void start(Stage primaryStage) { Rectangle rect = new Rectangle(25, 25, 50, 50); rect.setFill(Color.CADETBLUE); Label caption = new Label("Label1"); caption.setTranslateX(5);caption.setTranslateY(20); Line line = new Line(90, 40, 230, 50); line.setStroke(Color.BLACK); //circle x,y , radius Circle circle = new Circle(130, 130, 20); circle.setFill(Color.CHOCOLATE); //Pane proot = new Pane(); //FlowPane proot = new FlowkPane(Orientation.VERTICAL, 5, 5); StackPane proot = new StackPane(); proot.getChildren().addAll(caption,rect,circle,line); Scene scene = new Scene(proot, 250, 220, Color.WHITESMOKE); //primaryStage.setTitle("Absolute layout"); primaryStage.setTitle("Stack Pane::VBox "); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } |
Runtime: As StackPane:
FlowPane:: Orientation Horizontal FlowPane:Vertical |