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

When the TextArea control is to increase the font size Operation response is slow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u20
    • javafx
    • Windows 7

      When you view the document file of about 400KB of Japanese in high DPI environment, operation (Select Text, Scroll, Ins, Del, etc) response is very slow.

      Font size in the following test code I found that a significant impact on TextArea of performance.

      test code:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TextArea;
      import javafx.scene.layout.StackPane;
      import javafx.scene.text.Font;
      import javafx.stage.Stage;

      public class TextAreaTest extends Application {

          @Override
          public void start(Stage stage) throws Exception {
              StackPane pane = new StackPane();
              TextArea textArea = new TextArea();
              
              textArea.setWrapText(true);
              StringBuilder buf = new StringBuilder();
              
              String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
              String number = "0123456789";
              String testchar = alpha + number;
              
              for(int i=0; i<100000; i++){
                  buf.append(testchar.charAt(i%testchar.length()));
                  if(i>0 && i%100 == 0){
                      buf.append("\n");
                  }
              }
              
              textArea.setFont(Font.getDefault().font(120.0));
      // textArea.setFont(Font.getDefault().font(60.0));
      // textArea.setFont(Font.getDefault().font(20.0));
      // textArea.setFont(Font.getDefault().font(12.0));
              textArea.setText(buf.toString());
              pane.getChildren().add(textArea);
              Scene scene = new Scene(pane);
              stage.setScene(scene);
              stage.show();
          }

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

            prr Philip Race
            nyoshimotjfx Naohiro Yoshimoto (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Imported: