title: JavaFX FileRader read lines gui show counter
body: <p>I have a little problem.</p>
  
  <p>Here is my code</p>
  
  <pre><code>package email;
  
  import java.io.BufferedReader;
  import java.io.File;
  import java.io.FileReader;
  import java.io.IOException;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.scene.control.Button;
  import javafx.scene.control.Label;
  import javafx.scene.control.TextField;
  import javafx.stage.FileChooser;
  
  public class Controller {
  
  @FXML
  public static Label daten;
  
  
  @FXML
  public static Button Datei;
  
  @FXML
  public TextField Trennzeichen;
  
  static int i = 0;
  
  
  @FXML
  public void Datei(ActionEvent event) throws IOException, InterruptedException {
  
  FileChooser fileChooser = new FileChooser();
  File file = fileChooser.showOpenDialog(null);
  
  FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt");
  fileChooser.getExtensionFilters().add(extFilter);
  
  String[] buffer = new String[9];
  String[][] data = new String[2000][9];
  
  try {
  BufferedReader reader = new BufferedReader(new FileReader(file));
  String zeile = reader.readLine();
  while (zeile != null) {
  if ((zeile.substring(0, 1).equals("I")) || (zeile.substring(0, 1).equals("-"))) {
  System.out.println("ha");
  } else {
  
  buffer = zeile.split(Trennzeichen.getText());
  
  for (int t = 0; t &lt; buffer.length; t++) {
  data[i][t] = buffer[t];
  }
  ++i;
  daten.setText("" + i);
  
  }
  zeile = reader.readLine();
  }
  
  } catch (IOException e) {
  e.printStackTrace();
  }
  
  }
  }
  </code></pre>
  
  <p>I have a Label on my GUI, thats have to show me how many lines are in my txt file.</p>
  
  <p>This works fine, but it is not live, the gui update after the work, before is the gui freezy..</p>
  
  <p>How can I fix this in a task? </p>
  
  <p>short again:</p>
  
  <p>I have 1 label
  filechooser thats load a txt file
  the label have to show how many lines are reading after every line</p>