title: How to check if the input is a double
body: <p>I wrote a very basic Fahrenheit to Celsius converter just for practice and it seems to be working but I'd like to include some code that would tell the user to "Enter a valid number" if they either add a String or nothing. I'm assuming that I need an if statement to check if the value is == to double like it's supposed to be I'm not sure how to do this. Everything I try gives me some kind of error and the variable "value" is always underlined with a red squiggly.</p>
  
  <p>Here's what I have:</p>
  
  <pre><code>package sample;
  
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.scene.control.Button;
  import javafx.scene.control.TextField;
  
  public class Controller {
  
      @FXML
      private TextField textBoxC;
  
      @FXML
      private Button btnCels;
  
      @FXML
      private TextField textBoxF;
  
      @FXML
      void btnCels_onAction(ActionEvent event) {
  
                    double value = Double.parseDouble(textBoxF.getText());
                    double answer = value * 9 / 5 + 35;
                    textBoxC.setText(String.valueOf(answer));
  
        }
  }
  </code></pre>
  
  <p>What could I add to this code to make it run ONLY if the value in textBoxF was a valid double data type? </p>
  
  <p>Thank you very much. </p>