title: JavaFX: Load String from File and set to Label
body: <p>Not only have I lost 5 hours but also almost my mind because of this problem. </p>
  
  <p>I load a String from a Txt File and want to set it to the label sourceURL. Before I check it in System.out.println("Firstline is : " + brTest.readLine()); and it shows the String correctli. But then the UI pops up and the label is empty.</p>
  
  <p>It looks like it couldnt load it and needs to refresh. Do you know anything here?</p>
  
  <p><strong>DashBoardController</strong></p>
  
  <pre><code>    import java.io.BufferedReader;
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.FileReader;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.scene.control.Label;
  import javafx.scene.text.Font;
  import javafx.stage.DirectoryChooser;
  
  public class DashboardController {
  
      @FXML
      private Label userFeedback;
  
      @FXML
      private Font x1;
  
      @FXML
      private Label sourceURL;
  
      @FXML
      private Label targetURL;
  
      @FXML
      public void initialize(){
          BufferedReader brTest;
          try {
              brTest = new BufferedReader(new FileReader(new File("settings/sourceurl.txt")));
              System.out.println("Firstline is : " + brTest.readLine());
  
              String temp = brTest.readLine();
              sourceURL.setText(brTest.readLine());
              sourceURL.setText(temp);
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  
      @FXML
      void convert(ActionEvent event) {
  
      }
  
      @FXML
      void openFolder(ActionEvent event) {
  
      }
  
      @FXML
      void selectSource(ActionEvent event) throws FileNotFoundException {
          //DirectoryChooser initialisieren
          DirectoryChooser directoryChooser = new DirectoryChooser();
          directoryChooser.setTitle("Quellordner wählen");
  
          //URL speichern
          File selectedDirectory = directoryChooser.showDialog(null);
          sourceURL.setText(selectedDirectory.getAbsolutePath());
  
          //Ordner erstellen
          File settings = new File("settings");
          settings.mkdir();
  
          //Datei erstellen und URL abspeichern
          PrintWriter printWriter = new PrintWriter("settings/sourceurl.txt");
          printWriter.println(selectedDirectory.getAbsolutePath());
          printWriter.close();
      }
  
      @FXML
      void selectTarget(ActionEvent event) {
          sourceURL.setText("sdfkjasdöfl");
      }
  
      @FXML
      void showInfo(ActionEvent event) {
  
      }
  
      @FXML
      void showSupport(ActionEvent event) {
  
      }
  }
  </code></pre>
  
  <p>Dashboard</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Scene;
  import javafx.scene.layout.Pane;
  import javafx.stage.Stage;
  
  public class Dashboard extends Application {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          launch(args);
      }
  
      @Override
      public void start(Stage stage) throws Exception {
          // TODO Auto-generated method stub
  
          //Pane laden
          Pane pane = (Pane) FXMLLoader.load(Dashboard.class.getResource("Dashboard.fxml"));
  
          //Stage einrichten
          stage.setScene(new Scene(pane));
          stage.setTitle("");
          stage.setResizable(false);
          stage.show();
      }
  
  }
  </code></pre>