RectangleGridNoSetConstraints1
 
Code:

package javafxtemplate1;
//Grid_Transform1.htm
//textProperty().addListener Listview Label
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.transform.Rotate;

/**
*
* @author Manas9
*/
public class JavaFXTemplate1 extends Application {

@Override
public void start(Stage primaryStage) throws Exception {
//Node str1 = new Node(" xxx ");
Image image1 = new Image(JavaFXTemplate1.class.getResourceAsStream("disk1.jpg"));
ImageView iv1 = new ImageView(image1);
iv1.setFitHeight(25);iv1.setFitWidth(50);
GridPane gridPane = new GridPane();
gridPane.setHgap(10);
gridPane.setPadding(new Insets(50, 25, 25, 25));
gridPane.setGridLinesVisible(true);
//
Rectangle rect1 = new Rectangle(100, 50, Color.LIGHTGRAY);
Rectangle rect2 = new Rectangle(120, 20, 100, 50);
rect2.setFill(Color.BROWN);
//
//Label label1 = new Label("label1");
//Label label2 = new Label("label2");
Label label3 = new Label("label3");
gridPane.getChildren().addAll(rect1,rect2,label3,iv1);
gridPane.setStyle("-fx-padding: 10;" +
"-fx-border-style: solid inside;" +
"-fx-border-width: 2;" +
"-fx-border-insets: 5;" +
"-fx-border-radius: 5;" +
"-fx-border-color: blue;");
//gridPane.getColumnConstraints().add(new ColumnConstraints(100));
/*
//GridPane.setConstraints(str1,0,0);
GridPane.setConstraints(rect1,1,0);
GridPane.setConstraints(rect2,2,0);
GridPane.setConstraints(label3,3,0);
GridPane.setConstraints(iv1,4,0);

//
*/
Scene scene = new Scene(gridPane, 350,100);
primaryStage.setScene(scene);
primaryStage.setTitle("Layout Control::GridPane");
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

run-time displays : compare with Rectangle_GridSetConstraints1.htm