When I resize a TextArea smaller it often displays unnecessary scrollbars that will remain when you stop resizing.
To observe run the following test class:
1. Drag the window border smaller in either height or width.
2. Notice that scrollbars will show and disappear as you resize smaller,
3. Try to stop resizing when the scrollbars are visible. Now type some text in the TextArea and watch the scrollbars properly disappear.
************************************ TestClass **********************************************************
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class TextAreaTest extends Application {
/** {@inheritDoc} */
@Override public void start(Stage primaryStage) throws Exception {
primaryStage.centerOnScreen();
primaryStage.setHeight(350);
primaryStage.setWidth(500);
TextArea area = new TextArea();
area.setPrefColumnCount(5);
area.setPrefRowCount(5);
primaryStage.setScene(new Scene( new StackPane(area) ));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
To observe run the following test class:
1. Drag the window border smaller in either height or width.
2. Notice that scrollbars will show and disappear as you resize smaller,
3. Try to stop resizing when the scrollbars are visible. Now type some text in the TextArea and watch the scrollbars properly disappear.
************************************ TestClass **********************************************************
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class TextAreaTest extends Application {
/** {@inheritDoc} */
@Override public void start(Stage primaryStage) throws Exception {
primaryStage.centerOnScreen();
primaryStage.setHeight(350);
primaryStage.setWidth(500);
TextArea area = new TextArea();
area.setPrefColumnCount(5);
area.setPrefRowCount(5);
primaryStage.setScene(new Scene( new StackPane(area) ));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
- duplicates
-
JDK-8097060 [Modena, TextArea] Vertical scrollbar appears in TextArea and then disappears
-
- Resolved
-