How to add multiple objects to Grid Pane at once
<p>I am mostly just doing this to try and speed up some tedious office tasks.</p>

<p>So far I have created a <code>GridPane</code> of what I want, and I want to copy that setup and duplicate it directly below the existing <code>GridPane</code>.</p>

<p>Right now it sort of works. It copies the <code>Label</code>s and <code>TextField</code>s just fine, but it places them all into one column instead of copying the layout I already made. I figured it wouldn't work since none of the column/row index's were updated. I don't understand why it sticks it all in one column though.</p>

<p>If anyone could point me in the right direction to make this work that would be awesome.</p>

<pre><code>package application;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.Screen;

public class Main extends Application {

    Label   sample, USCS, ColorField, DensityLabel, MoistureField,
            startElevationField, endElevationField, BlowCount6Field,
            BlowCount12Field, BlowCount18Field, LabTestField,
            SamplerTypeField;

    TextField   sampleTextField, USCSTextField, ColorTextField,
                DensityTextField, MoistureTextField,
                startElevationTextField, endElevationTextField,
                BlowCount6TextField, BlowCount12TextField,
                BlowCount18TextField, LabTestTextField,
                SamplerTypeTextField;

    int rowMod, columnMod;

    GridPane grid;

    Scene scene;

    Button btn;


    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Boring Logger+");
        createGrid();
        scene = new Scene(grid, 900, 600);
        primaryStage.setScene(scene);
        primaryStage.show();

    }

    public GridPane createGrid(){
        grid = new GridPane();
        grid.setAlignment(Pos.TOP_LEFT);
        grid.setHgap(10);
        grid.setVgap(10);
        grid.setPadding(new Insets(25, 25, 25, 25));

        sample = new Label("Sample Label");
        grid.add(sample, 0, 3);
        sample.setPrefWidth(150);
        sample.setAlignment(Pos.CENTER);

        sampleTextField = new TextField();
        grid.add(sampleTextField, 0, 4);

        USCS = new Label("USCS");
        grid.add(USCS, 1, 0);
        USCS.setPrefWidth(150);
        USCS.setAlignment(Pos.CENTER);

        USCSTextField = new TextField();
        grid.add(USCSTextField, 1, 1);

        ColorField = new Label("Color");
        grid.add(ColorField, 2, 0);
        ColorField.setPrefWidth(150);
        ColorField.setAlignment(Pos.CENTER);

        ColorTextField = new TextField();
        grid.add(ColorTextField, 2, 1);

        DensityLabel = new Label("Density");
        grid.add(DensityLabel, 3, 0);
        DensityLabel.setPrefWidth(150);
        DensityLabel.setAlignment(Pos.CENTER);

        DensityTextField = new TextField();
        grid.add(DensityTextField, 3, 1);

        MoistureField = new Label("Moisture");
        grid.add(MoistureField, 4, 0);
        MoistureField.setPrefWidth(150);
        MoistureField.setAlignment(Pos.CENTER);

        MoistureTextField = new TextField();
        grid.add(MoistureTextField, 4, 1);

        startElevationField = new Label("Start Elevation");
        grid.add(startElevationField, 1, 3);
        startElevationField.setPrefWidth(150);
        startElevationField.setAlignment(Pos.CENTER);

        startElevationTextField = new TextField();
        grid.add(startElevationTextField, 1, 4);

        endElevationField = new Label("End Elevation");
        grid.add(endElevationField, 2, 3);
        endElevationField.setPrefWidth(150);
        endElevationField.setAlignment(Pos.CENTER);

        endElevationTextField = new TextField();
        grid.add(endElevationTextField, 2, 4);

        BlowCount6Field = new Label("Blow Count @ 6in");
        grid.add(BlowCount6Field, 3, 3);
        BlowCount6Field.setPrefWidth(150);
        BlowCount6Field.setAlignment(Pos.CENTER);

        BlowCount6TextField = new TextField();
        grid.add(BlowCount6TextField, 3, 4);

        BlowCount12Field = new Label("Blow Count @ 12in");
        grid.add(BlowCount12Field, 4, 3);
        BlowCount12Field.setPrefWidth(150);
        BlowCount12Field.setAlignment(Pos.CENTER);

        BlowCount12TextField = new TextField();
        grid.add(BlowCount12TextField, 4, 4);

        BlowCount18Field = new Label("Blow Count @ 18in");
        grid.add(BlowCount18Field, 1, 5);
        BlowCount18Field.setPrefWidth(150);
        BlowCount18Field.setAlignment(Pos.CENTER);

        BlowCount18TextField = new TextField();
        grid.add(BlowCount18TextField, 1, 6);

        LabTestField = new Label("Lab Test?");
        grid.add(LabTestField, 2, 5);
        LabTestField.setPrefWidth(150);
        LabTestField.setAlignment(Pos.CENTER);

        LabTestTextField = new TextField();
        grid.add(LabTestTextField, 2, 6);

        SamplerTypeField = new Label("Sampler Type");
        grid.add(SamplerTypeField, 3, 5);
        SamplerTypeField.setPrefWidth(150);
        SamplerTypeField.setAlignment(Pos.CENTER);

        SamplerTypeTextField = new TextField();
        grid.add(SamplerTypeTextField, 3, 6);

        Button();
        return grid;
    }

    public void Button(){
        //Add new Grid Button
        btn = new Button("Add Sample");
        grid.add(btn, 4, 6);
        btn.setPrefWidth(150);
        final GridPane actiontarget = new GridPane();
        grid.add(actiontarget, 1, 7);

        btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() {

            @Override
            public void handle(ActionEvent event) {
                actiontarget.add(createGrid(), 0, 0, 4, 6);
            }

//            @Override
//            public void handle(ActionEvent e) {
//                actiontarget.setFill(Color.FIREBRICK);
//                actiontarget.setText("Sign in button pressed");
//            }
        });
    }
}
</code></pre>