title: Why doesn't TextArea occupy entire area of ScrollPane in JavaFX? How to add scroll bars to TextArea in JavaFX?
body: <p>In Swing I was to add <code>JTextArea</code> into <code>JScrollPane</code> in order <code>JTextArea</code> to have scroll bars. When I do the same in <code>JavaFX</code>, the behavior is different.</p>
  
  <p>This example</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.scene.Scene;
  import javafx.scene.control.ScrollPane;
  import javafx.scene.control.TextArea;
  import javafx.stage.Stage;
  
  public class SlideshowForSlipryPage2 extends Application {
  
      @Override
      public void start(Stage primaryStage) {
  
  
          primaryStage.setTitle("SlideshowForSlipryPage");
          primaryStage.setScene(
              new Scene(
  
  
                      new ScrollPane(
                          new TextArea() {{
                              setPromptText("[PROMPT 1]");
                          }}
                      )
  
  
                  , 300, 250
              )
          );
          primaryStage.show();
  
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>gives</p>
  
  <p><img src="https://i.stack.imgur.com/6KgQX.png" alt="enter image description here"></p>
  
  <p>i.e. text area is wider than a window and shorter than it.</p>
  
  <p>Why and how to fix?</p>