title: Searching and highlighting in a TextArea
body: <p>I have a TextArea with a text in which I want to search for word(s). The search works, but highlighting the word with selectRange() does not. Is there a different method for highlighting? </p>
  
  <pre><code>            findButton.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler&lt;MouseEvent&gt;() {
              @Override 
              public void handle(MouseEvent e) {
  
                  if (textField.getText() != null &amp;&amp; !textField.getText().isEmpty()) {
                      int index = textArea.getText().indexOf(textField.getText()); 
                      if (index == -1) {
                          errorText.setText("Search key Not in the text");
                      } else {
                        //  errorText.setText("Found");
                          textArea.selectRange(textField.getText().charAt(0), textField.getLength());    
                      }       
                  } else {
                      errorText.setText("Missing search key");
                    //  errorText.setFill(Color.RED);
  
                  }
              }
          }); 
  </code></pre>