Why Javafx UI hangs or become unresponsive on using Plarform.runLater() ? (Jonathan Giles)

Jeffrey Guenther guenther.jeffrey at gmail.com
Mon Oct 20 15:13:12 UTC 2014


I second Jonathan’s suggestion of RichTextFX. 

To do syntax highlighting and style the text area you can use a combination of CSS and an extension I wrote for RichTextFX that allows you to highlight any language’s syntax based on an ANTLR grammar. It allows you to pass a mapping between an ANTLR token type and class name to do the highlighting. The work is still in it’s infancy, but it works and might be helpful to you. You can see it at https://github.com/jrguenther/Xanthic. You should be able to create a stylesheet the is similar to monokai.

The goal of Xanthic is to create a tool like pygments written in Java and making use of the ANTLR lexer/parser library. One of the output formats will be RichTextFX StyleSpans. One of the other goals of the project is to make use of the large ecosystem of pygments stylesheets by providing a converter to make them JavaFX stylesheets. Just haven’t got to it yet.


On Oct 19, 2014, at 1:08 PM, openjfx-dev-request at openjdk.java.net wrote
> 
> 
> From: Jonathan Giles <jonathan.giles at oracle.com>
> Subject: Re: Why Javafx UI hangs or become unresponsive on using Plarform.runLater() ?
> Date: October 19, 2014 at 1:08:47 PM PDT
> To: openjfx-dev at openjdk.java.net
> Reply-To: jonathan.giles at oracle.com
> 
> 
> The point Tom and Michael make is correct - TextArea is not virtualised, which means that there is indeed a Text node internally containing all text you've set on the TextArea - even if it is not visible. This is clearly not efficient for large amounts of text - as Michael said you want to virtualise the visuals so that you don't have all the text in a Text node at once.
> 
> One way that people do this is with the ListView control (or its underlying implementation). There exists a few options you should explore, including Tom's implementation and RichTextFX [1] by Tomas Mikula.
> 
> [1] https://github.com/TomasMikula/RichTextFX
> 
> -- Jonathan



More information about the openjfx-dev mailing list