Run the sample program:
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;
public class SampleTextArea extends Application {
@Override
public void start(Stage stage) throws Exception {
final TextArea textArea = new TextArea();
textArea.setPrefRowCount(10);
textArea.setPrefColumnCount(300);
textArea.setWrapText(true);
textArea.setPrefWidth(300);
textArea.setPadding(new Insets(5));
String text = "Some random text";
textArea.setText(text);
Scene scene = new Scene(textArea);
stage.setScene(scene);
stage.setTitle("Text Area");
stage.show();
}
public static void main(String... arguments) {
launch(arguments);
}
}
1) You will notice a vertical scroll bar is displayed which shouldn't be as the scroll bar thumb fills all its available space and you cannot use it to scroll the text area.
2) Click inside the TextArea. The scroll bar disappears. It remains invisible even if you now click outside the Stage.
3) Now if you increase the size of the stage using mouse, the scroll bar disappears but if you decrease the size the scroll bar reappears even for the same previous size of stage. Here similarly to 1) the thumb of the scroll bar fills all its available space and you cannot use it to scroll the text area.
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;
public class SampleTextArea extends Application {
@Override
public void start(Stage stage) throws Exception {
final TextArea textArea = new TextArea();
textArea.setPrefRowCount(10);
textArea.setPrefColumnCount(300);
textArea.setWrapText(true);
textArea.setPrefWidth(300);
textArea.setPadding(new Insets(5));
String text = "Some random text";
textArea.setText(text);
Scene scene = new Scene(textArea);
stage.setScene(scene);
stage.setTitle("Text Area");
stage.show();
}
public static void main(String... arguments) {
launch(arguments);
}
}
1) You will notice a vertical scroll bar is displayed which shouldn't be as the scroll bar thumb fills all its available space and you cannot use it to scroll the text area.
2) Click inside the TextArea. The scroll bar disappears. It remains invisible even if you now click outside the Stage.
3) Now if you increase the size of the stage using mouse, the scroll bar disappears but if you decrease the size the scroll bar reappears even for the same previous size of stage. Here similarly to 1) the thumb of the scroll bar fills all its available space and you cannot use it to scroll the text area.
- duplicates
-
JDK-8097060 [Modena, TextArea] Vertical scrollbar appears in TextArea and then disappears
-
- Resolved
-