Rich Text Support

Robert Lichtenberger r.lichtenberger at gmail.com
Tue Oct 9 05:12:21 UTC 2018


Am 03.10.2018 um 14:21 schrieb Pedro Duque Vieira:
> Hi,
>
> Have you guys tried JavaFX TextFlow class and such for just the display
> part of rich text?
I have some (albeit very old now) background in writing an editor for an
IDE.

The the best of my knowledge, TextFlow is not even usable to display
large amounts of (colored/highlighted) text let alone make it editable.

I've tried and rigged together a little piece of code that would display
an XML file in a colorful way (i.e. three to five Texts per line plus an
additional Text-Object per line).

Displaying a file with 5 MB will consume a whopping 800 MB of
Text-objects in that way. The application has never been able to render
anything beyond tiny files.

Displaying text files in a graph of nodes is just plain wrong. You have
to invert the situation so that only the part of the file that is
currently visible gets rendered.
That is where things get complicated (in my opinion), because JavaFX
dictates (AFAIK) that rendering has to be the other way round. While
painting callbacks may seem like an artifact of the past they are
superior when it comes to rendering texts. (Model-View-Controller ...
anyone still remembering ?)

Maybe something can be done with a Canvas in a ScrollPane (will have to
try that), but TextFlow seems to rather mislead people into the wrong
direction.

BTW, TextArea is also very bad performance-wise: Loading the 5 MB file
into a textarea makes the application unresponsive (on both Linux and
Windows)





More information about the openjfx-discuss mailing list