JavaFX: How to get more "dummy/empty Rows"
<p>I have a Javafx TableView where I can add new Rows by double Click on an empty Row at the End of my "filled" / Textfield filled Rows.
My Problem is,if i add some Rows ,Java don't give me more of the empty Rows I could double click to add some Rows.
Edit:removed some unnessary log</p>

<p>To see what i mean, here is the Code:</p>

<pre><code>import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TextArea;
import javafx.util.Callback;

import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;


interface inside_table
{
    public void Select_Row_by_Col(int index);
}

public class Supermain extends Application {
    ObservableList&lt;myTextRow&gt; data;

    @Override
    public void start(Stage primaryStage) {

        ArrayList myindizes=new ArrayList();



        final TableView&lt;myTextRow&gt; table = new TableView&lt;&gt;();
        table.setEditable(true);
        table.setStyle("-fx-text-wrap: true;");

        //Table columns
        TableColumn&lt;myTextRow, String&gt; clmID = new TableColumn&lt;&gt;("ID");
        clmID.setMinWidth(160);
        clmID.setCellValueFactory(new PropertyValueFactory&lt;&gt;("ID"));

        TableColumn&lt;myTextRow, String&gt; clmtext = new TableColumn&lt;&gt;("Text");
        clmtext.setMinWidth(160);
        clmtext.setCellValueFactory(new PropertyValueFactory&lt;&gt;("text"));
        clmtext.setCellFactory(new TextFieldCellFactory("text"));

        TableColumn&lt;myTextRow, String&gt; clmtext2 = new TableColumn&lt;&gt;("Text2");
        clmtext2.setMinWidth(160);
        clmtext2.setCellValueFactory(new PropertyValueFactory&lt;&gt;("text2"));
        clmtext2.setCellFactory(new TextFieldCellFactory("text2"));

        //Add data
        data = FXCollections.observableArrayList(
                new myTextRow(5, "Lorem","bla"),
                new myTextRow(2, "Ipsum","bla")
        );

        table.getColumns().addAll(clmID, clmtext,clmtext2);
        table.setItems(data);

        table.setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;() {
            @Override
            public void handle(MouseEvent mouseEvent) {
                if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
                    if (mouseEvent.getClickCount() == 2 &amp;&amp; mouseEvent.getY()&gt;24) {
                        data.add(new myTextRow(td_get_biggest_ID() + 1,"",""));  
                        table.selectionModelProperty().get().select(data.size()-1);
                    }
                }
            }
        });

        HBox hBox = new HBox();
        hBox.setSpacing(5.0);
        hBox.setPadding(new Insets(5, 5, 5, 5));

        Button btn = new Button();
        btn.setText("Get Data");
        btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() {

            @Override
            public void handle(ActionEvent event) {
                for (myTextRow data1 : data) {
                    System.out.println("data:" + data1.getText2());
                }
            }
        });

        hBox.getChildren().add(btn);

        BorderPane pane = new BorderPane();
        pane.setTop(hBox);
        pane.setCenter(table);
        primaryStage.setScene(new Scene(pane, 640, 480));
        primaryStage.show();

        class I_table implements inside_table{

            @Override
            public void Select_Row_by_Col(int index) {
                table.getSelectionModel().select(index);
            }

        }


    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }


    public static class TextFieldCellFactory
            implements Callback&lt;TableColumn&lt;myTextRow, String&gt;, TableCell&lt;myTextRow, String&gt;&gt; {

        private String ColumnName;

        public TextFieldCellFactory(String ColumnName){
        this.ColumnName=ColumnName;
        }

        @Override
        public TableCell&lt;myTextRow, String&gt; call(TableColumn&lt;myTextRow, String&gt; param) {
            TextFieldCell textFieldCell = new TextFieldCell(this.ColumnName);
            return textFieldCell;

        }

        public static class TextFieldCell extends TableCell&lt;myTextRow, String&gt; {

            private TextArea textField;
            private StringProperty boundToCurrently = null;
            private String last_text;
            private String ColumnName;


            public TextFieldCell(String cname) {

                textField = new TextArea();
                textField.setWrapText(true);
                textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
                last_text="";
                this.ColumnName=cname;



                this.setGraphic(textField);

                textField.focusedProperty().addListener((obs, wasFocused, isNowFocused) -&gt; { 
                    if(this.ColumnName=="text2"){
                        if(isNowFocused){last_text=textField.getText();System.out.println("NOW focus "+last_text);}
                        if (! isNowFocused &amp;&amp; ! isValid(textField.getText())) { 
                            textField.setText(last_text);
                            //textField.setText("00:00:00:00");
                            textField.selectAll();
                            System.out.println("blur");

                        }
                    }

                });

            }

            @Override
            protected void updateItem(String item, boolean empty) {
                super.updateItem(item, empty);
                if (!empty) {
                    // Show the Text Field
                    this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);


                   // myindizes.add(getIndex());

                    // Retrieve the actual String Property that should be bound to the TextField
                    // If the TextField is currently bound to a different StringProperty
                    // Unbind the old property and rebind to the new one
                    ObservableValue&lt;String&gt; ov = getTableColumn().getCellObservableValue(getIndex());
                    SimpleStringProperty sp = (SimpleStringProperty) ov;

                    if (this.boundToCurrently == null) {
                        this.boundToCurrently = sp;
                        this.textField.textProperty().bindBidirectional(sp);
                    } else if (this.boundToCurrently != sp) {
                        this.textField.textProperty().unbindBidirectional(this.boundToCurrently);
                        this.boundToCurrently = sp;
                        this.textField.textProperty().bindBidirectional(this.boundToCurrently);
                    }

                    double height = real_lines_height(textField.getText(), this.getWidth(), 30, 22);
                    textField.setPrefHeight(height);
                    textField.setMaxHeight(height);

                    textField.setMaxHeight(Double.MAX_VALUE);
                    // if height bigger than the biggest height in the row
                    //-&gt; change all heights of the row(textfields ()typeof textarea) to this height
                    // else leave the height as it is


                    //System.out.println("item=" + item + " ObservableValue&lt;String&gt;=" + ov.getValue());
                    //this.textField.setText(item);  // No longer need this!!!
                } else {
                    this.setContentDisplay(ContentDisplay.TEXT_ONLY);
                }
            }//update

            private boolean isValid(String s){

                String splitArray[] = s.split(":");
                if (splitArray.length != 4) {
                    System.out.println("false");
                    return false;
                }

                for (int i = 0; i &lt; splitArray.length; i++) {

                    if (splitArray[i].length() != 2) {
                        System.out.println("false");
                        return false;
                    }
                    if (!splitArray[i].substring(0, 1).matches("[0-9]")) {
                        System.out.println("no number1");
                        return false;
                    }
                    if (!splitArray[i].substring(1, 2).matches("[0-9]")) {
                        System.out.println("no number2");
                        return false;
                    }

                    if (i &lt; 3) {
                        int itest = Integer.parseInt(splitArray[i]);
                        if (itest &gt; 59) {
                            System.out.println(itest + " ist zu groß!");
                            return false;
                        }
                    } else {
                        int itest2 = Integer.parseInt(splitArray[i]);
                        if (itest2 &gt; Math.floor(25)) {
                            System.out.println(itest2 + " ist zu groß!");
                            return false;
                        }
                        //framerate!!!!!
                    }

                    System.out.println("splits: " + splitArray[i]);
                    //if( el.charAt(0).)
                }

                return true;

            }

        }

    }

    public class myTextRow {

        private final SimpleIntegerProperty ID;

        private final SimpleStringProperty text;
        private final SimpleStringProperty text2;

        public myTextRow(int ID, String text,String text2) {

            this.ID = new SimpleIntegerProperty(ID);
            this.text = new SimpleStringProperty(text);
            this.text2 = new SimpleStringProperty(text2);


        }


        //setter
        public void setID(int id) {
            this.ID.set(id);
        }

        public void setText(String text) {
            this.text.set(text);
        }

        public void setText2(String text) {         
            this.text2.set(text);         
        }

       //getter
        public int getID() {
            return ID.get();
        }

        public String getText() {
            return text.get();
        }

        public String getText2() {
            return text2.get();
        }

        //properties
        public StringProperty textProperty() {
        return text;

        }

        public StringProperty text2Property() {
        return text2;

        }

    public IntegerProperty IDProperty() {
        return ID;
    }

    }

    private static double real_lines_height(String s, double width, double heightCorrector, double widthCorrector) {
        HBox h = new HBox();
        Label l = new Label("Text");
        h.getChildren().add(l);
        Scene sc = new Scene(h);
        l.applyCss();
        double line_height = l.prefHeight(-1);

        int new_lines = s.replaceAll("[^\r\n|\r|\n]", "").length();
        //  System.out.println("new lines= "+new_lines);
        String[] lines = s.split("\r\n|\r|\n");
        //  System.out.println("line count func= "+ lines.length);
        int count = 0;
        //double rest=0;
        for (int i = 0; i &lt; lines.length; i++) {
            double text_width = get_text_width(lines[i]);
            double plus_lines = Math.ceil(text_width / (width - widthCorrector));
            if (plus_lines &gt; 1) {
                count += plus_lines;
                //rest+= (text_width / (width-widthCorrector)) - plus_lines;
            } else {
                count += 1;
            }

        }
        //count+=(int) Math.ceil(rest);
        count += new_lines - lines.length;

        return count * line_height + heightCorrector;
    }

    private static double get_text_width(String s) {
        HBox h = new HBox();
        Label l = new Label(s);
        l.setWrapText(false);
        h.getChildren().add(l);
        Scene sc = new Scene(h);
        l.applyCss();
        // System.out.println("FXMLDocumentController.get_text_width(): "+l.prefWidth(-1));
        return l.prefWidth(-1);

    }
    public int td_get_biggest_ID() {
        int biggest = 0;
        for (int i = 0; i &lt; data.size(); i++) {
            if (((myTextRow) data.get(i)).getID() &gt; biggest) {
                biggest = ((myTextRow) data.get(i)).getID();
            }
        }
        return biggest;
    }

}
</code></pre>