public void append(String text) {
        if (textArea.getText().length() == 0){
            int numLines = textArea.getHeight() / textArea.getFontMetrics(textArea.getFont()).getHeight();
            for (int i = 1; i < numLines; i++)
                textArea.append(System.lineSeparator());
        }
        int tl = textArea.getText().length();
        textArea.select(tl-temp.length(), tl);
        textArea.replaceSelection(text);
        textArea.append(text);
        textArea.setCaretPosition(textArea.getText().length());
        temp = text;
    }