gluonhq / rich-text-area

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RTA fails to show large content

abhinayagarwal opened this issue · comments

RichTextArea with large amount of lines is able to show up on the scene, however the scrolling is very slow.

Here is a SSCCE:

import com.gluonhq.richtextarea.RichTextArea;
import com.gluonhq.richtextarea.model.Document;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class TextAreaTest extends Application {

    @Override
    public void start(Stage stage) {
        String hugeString = IntStream.range(0, 1_000_000).mapToObj(String::valueOf).collect(Collectors.joining("\n"));
        RichTextArea richTextArea = new RichTextArea();
        richTextArea.setDocument(new Document(hugeString));
        Scene scene = new Scene(new StackPane(richTextArea), 640, 480);
        stage.setScene(scene);
        stage.show();
    }

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

}

RichTextFX can run the same sample without any issue.