RFR: 8301121: RichTextArea Control (Incubator)

Andy Goryachev angorya at openjdk.org
Fri Aug 2 18:37:38 UTC 2024


On Fri, 2 Aug 2024 18:30:22 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> I was hoping to be able to easily replace one (old) control with the _new_ one. I mean `RichTextArea` still fulfilling the requirements of `TextInputControl`. Anyhow, I understand you rational not going along this path 👍
>> 
>> Let me provide the use-case I have in mind (which may explain better what I am looking for).
>> I would like to use/keep textfields and textareas with pure text. Anyhow, having the  possibility to _squiggly_ parts of the text showing spelling mistakes. Since I assume that loading many `RichTextArea` controls (i.e., in tables) will take much longer I expect to offer spelling suggestions (and `RichTextArea`  loading) on request only.
>
> It looks like in this particular case you do want to preserve the semantics and APIs of TextArea, rather than switch to a new API.
> 
> You could simply extend TextArea/Skin and add functionality to superimpose the squiggly on top of TextArea.  You'll need to listen to several properties and make sure the clipping is set up correctly and you handle the scrolling et cetera, but I think it's doable.
> 
> Of course, once you decide that you need to further decorate your text, with let's say highlighted areas, then you might as well use the new component.
> 
> By the way, **CodeArea** is specifically designed for that purpose, even has `getText()` and `setText()` - but no textProperty because it's designed to work with large documents.

You might be right about impact on performance when trying to use many RichTextArea (RTA) controls as table cells - it is indeed a heavier component, but as long as you ensure there are no memory leaks and your table does not show 1000s of cells on screen we should be ok.

If performance is an issue, a full blown editor might indeed be overkill, and you might be better off created a subclass of Labeled adorned with decorations instead.  You can always set up RTA as an editor if you need to.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1524#discussion_r1702191592


More information about the openjfx-dev mailing list