I have this code, where I set my Log file in a TextArea. But when I click the Load log button, it shows the log in a line, how do I break line? I would also like the log to display in textArea at runtime, in real time, and not just at the end of the button.
@FXML
public void carregarLog(ActionEvent event) throws Exception {
textLog.setText("Logar Jira CAC");
fieldData.setText(dt);
String cac = JiraCac.guardarCac;
fieldCac.setText(cac);
String arq = "aqui vai pasta e nome do arquivo automacaoTestes.log";
try{
BufferedReader in = new BufferedReader(new FileReader(arq));
System.out.println("Arquivo lido!");
String str, txt = " \n\r " ;
while((str = in.readLine()) != null){
txt += str;
}
textLog.setText(txt);
}
catch (Exception e) {
System.err.println("erro");
}
}