I have a problem with resizing update/event of TextArea in JavaFX. For illustration I created empty JavaFX project through IntelliJ Idea with AnchorPane as root pane and that AnchorPane contains TextArea with propecties AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
in sample.fxml file (in a short: TextArea takes all space of scene).
Problem description: I launch application and it starts in a small window (300 x 275). I just maximalize it. There is normal behavioral, but when I got back in a window, both of scrollbars were shown. The similar situation happens when I am resizing window into smaller window. When I start with scrolling, nothing happens with TextArea viewport. When I start to write some letter or resize window into bigger window, scrollbars disappeared. That's very strange behavioral!
My question: Is there any listener or method for catch/stop showing scrollbars when it isn't necessary? Have you got this problem too?
Screenshot after return 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: Sorry for my english and repeat insertion of that question, but if it's bug of JavaFX, it's very acute to resolve where is problem!