I have a problem with TextArea resize / event in JavaFX. To illustrate, I created an empty JavaFX project through IntelliJ Idea with AnchorPane as the root panel and that AnchorPane contains TextArea with prospectuses AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"in the sample.fxml file (in short: TextArea takes up the whole scene space).
Description of the problem: I run the application and it starts in a small window (300 x 275). I just maximize it. There is normal behavior, but when I returned to the window, both scroll bars were shown. A similar situation occurs when I resize a window to a smaller window. When I start scrolling, nothing happens with the TextArea viewport. When I start writing a letter or resizing a window to a larger window, the scroll bars disappear. This is a very strange behavior!
My question is: Is there any listener or catch / stop method showing scroll bars when not needed? Do you have this problem too?
Screenshot after returning from maximized form

Main.java
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Controller.java
package sample;
public class Controller {
}
sample.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="480.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TextArea layoutX="162.0" layoutY="66.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
PS: , , JavaFX, , !