I'm writing a program that will allow a user to add new, empty text fields in the event that more data needs to be added to the form. I'm having trouble understanding how to set the coordinates for each new field that is added to my GridPane. For example,
btnClick.setOnAction(new EventHandler<ActionEvent>(){
public void handle(ActionEvent e)
{
TextField text = new TextField();
primaryPane.add(text, 5 , 6);
}});
will only result in one new text field being added in position (5,6). How can the code be altered to allow a user to add as many fields as they want, each one displaying after the other. I know that I could use a loop for a determined amount of new fields, however the user should be able to create any number. Thanks in advance for any help.
Nathan