Highlighting Strings in JavaFX TextArea

Marcelo picture Marcelo · Feb 3, 2012 · Viewed 28.2k times · Source

We are using JavaFX's TextArea control in our application, and trying to integrate it with Jazzy Spell Check API - as in, when a user enters a wrong word that is not in the dictionary, such word would be highlighted.

Is there a way to highlight a word in said control? I've seen no options for that in the JavaDocs, so if someone could suggest an approach?

It could be possible, I guess, to use the HTMLEditor component and color the words diferently with <font face="red=>wrongWord</font>. This, however, brings a whole lot of different problems with the spell checking, such as the html tags and words count.

Answer

Tomas Mikula picture Tomas Mikula · Oct 7, 2013

RichTextFX allows you to add style to text ranges.