title: How do i read a file line by line in javaFx using a button with mouse event
body: <p>When i press this button, its supposed to read the next line of a file, every time i press it. why is it not working with this code.</p>
  
  <pre><code>btnFrw.setOnMousePressed(e -&gt; {
      try {
          FileReader fr = new FileReader(file); //read 'file'
          br = new BufferedReader(fr); //read 'file'
          String line = "";
          while ((line = b.readLine()) != null) {
              line = br.readLine();
  
              StringTokenizer st = new StringTokenizer(line, ",");
              txtID.setText(st.nextToken());
              txtG.setText(st.nextToken());
              txtBP.setText(st.nextToken());
              txtD.setText(st.nextToken());
              txtCons.setText(st.nextToken());
              txtSP.setText(st.nextToken());
          }
      } catch(Exception k) {
          System.out.println("Reading file.");
      }
  });
  </code></pre>
  
  <p>ok so I figured it out to include a while loop. But that still doesnt do what i need. In one click it will read through all the lines and set the text areas to the current line. What i need is for it to move to a new line each time the buttons is clicked and set the text areas to that line using String tokenizer.</p>