I just added the following method to ManualHighlighting.java and call at the end of start(Stage primaryStage):
private void testLongText(){
Map<Integer, String> styles = new HashMap<>();
styles.put(0, "red");
styles.put(1, "green");
styles.put(2, "blue");
String text = "This is a test\n";
int times = 1000;
for (int i=0; i<times; i++){
area.replaceText(area.getLength(), area.getLength(), text);
area.setStyleClass(area.getLength() - text.length(), area.getLength(), styles.get(i%3) );
}
area.requestFocus();
}
Here is my style.css:
.red {
-fx-font-size: 12pt;
-fx-fill: "red";
}
.green {
-fx-font-size: 12pt;
-fx-fill: "green";
}
.blue {
-fx-font-size: 12pt;
-fx-fill: "blue";
}
This is what I get with 155 MB memory consumption:

When I set times = 10000; it stuck for 3-4 seconds and then I can see the same window above. The memory consumption is 475 MB. By the way a text file with 10000 lines of This is a test\n is 156 KB.
When I set times = 100000; the window does not respond.
pom.xml:
<dependency>
<groupId>org.fxmisc.richtext</groupId>
<artifactId>richtextfx</artifactId>
<version>0.6.2</version>
</dependency>
I just added the following method to ManualHighlighting.java and call at the end of
start(Stage primaryStage):Here is my style.css:
This is what I get with 155 MB memory consumption:
When I set
times = 10000;it stuck for 3-4 seconds and then I can see the same window above. The memory consumption is 475 MB. By the way a text file with 10000 lines ofThis is a test\nis 156 KB.When I set
times = 100000;the window does not respond.pom.xml: