title: JavaFX TextArea string reading issue
body: <p>I am trying to make a login system in JavaFX and i need to check so that the string for the textArea corresponding to email is the same as the email varibale in my User class. However, the method I use for comparing the string in the textArea with the user details will always return false. I am not sure why. I've tried .equals(), .compareTo, even .charAt() and tested it with 1 letter and it would still return false.</p>
  
  <p>Here is my code for the method. Note that this is the method i use for comparing the string in the textArea to the string in the User.getEmail.</p>
  
  <pre><code>public boolean checkCredentials()
      {
          return text1.getText().equals(user.getEmail());
      }
  </code></pre>
  
  <p>And here is my code for the method .getEmail() in my User class:</p>
  
  <pre><code>private String email = "1";
  public String getEmail()
  {
      return email;
  }
  </code></pre>
  
  <p>Also, even running this with the input in the textArea as "1", and the string Email in my user class as "1" I still get a return false:</p>
  
  <pre><code>public boolean checkCredentials()
      {
          return text1.getText().length() == user.getEmail().length();
      }
  </code></pre>
  
  <p>My guess is that somewhere the string from the textArea has something "extra" than the string in the User class. I have tried printing out the length of both strings and i get the same answer.</p>
  
  <p>Minimum code required to re-create, NOTE JavaFX must be installed, and the JavaFX Application template must be used:</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.geometry.Pos;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.control.Label;
  import javafx.scene.control.TextArea;
  import javafx.scene.layout.VBox;
  import javafx.stage.Stage;
  
  public class Main extends Application
  {
  
      Stage window;
      Scene scene1;
  
      String sEmail;
  
      // TextBoxes Dec.
      TextArea text1 = new TextArea();
  
      public static void main(String[] args)
      {
          launch(args);
      }
  
      public boolean checkCredentials()
      {
          return text1.getText().equals(sEmail);
      }
  
      @Override
      public void start(Stage primaryStage)
      {
          window = primaryStage;
  
          sEmail = "1";
  
          // TextBoxes Ini.
          text1.setMaxWidth(200);
          text1.setMaxHeight(25);
          text1.setMinHeight(25);
  
      // Button
      Button button1 = new Button("Check string");
          if(checkCredentials())
          {
              button1.setOnAction(e -&gt; System.out.println("The email is correct"));
          }
          else
          {
              button1.setOnAction(e -&gt; System.out.println("The email is NOT correct"));
          }
  
          // Layout1
          VBox layout1 = new VBox(20);
          layout1.setAlignment(Pos.CENTER);
          layout1.getChildren().add(text1, button1);
          scene1 = new Scene(layout1, 750, 500);
  
          window.setScene(scene1);
          window.setTitle("Hello");
          window.show();
      }
  
  }
  </code></pre>