Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8189732

TextArea doesn't scroll to bottom when texts becomes long and vertical scrollbar appears

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
    • CPU:
      x86_64
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      Run the following program:

      public class MainClass extends Application{

          public static void main(String[] args) {
              launch(args);
          }

          private int count;

          @Override
          public void start(Stage stage) throws Exception {
              Button button=new Button("Press");
              TextArea textArea=new TextArea();
              VBox vbox = new VBox(button,textArea);
              button.setOnAction((event)->{
                  textArea.appendText(++count + ") This is a very long string:some text some text some text some text some"
                          + " text some text some text some text some text some text"
                          + " text some text some text some text some text some text"
                          + " text some text some text some text some text some text.\n");
                  textArea.selectEnd();
                  textArea.deselect();
                  textArea.setScrollTop(Double.MAX_VALUE);
              });
              textArea.setEditable(true);
              textArea.setWrapText(true);
              textArea.setStyle("-fx-font-size:14px;-fx-focus-color: transparent;-fx-font-family: monospace;");
              Scene scene=new Scene(vbox);
              stage.setScene(scene);
              vbox.prefHeightProperty().bind(stage.heightProperty());
              vbox.prefWidthProperty().bind(stage.widthProperty());
              VBox.setVgrow(textArea, Priority.ALWAYS);
              stage.setMinHeight(250);
              stage.setMinWidth(350);
              stage.show();
          }
      }

      Press button two times. You will see that text is very long and scrollbar appears. However, you can not see the end of the total text because text area doesn't scroll to bottom. Press button one more time - now textarea scrolls to bottom. The problem is that textarea had to scroll to bottom after two times but doesn't do that.


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: