On Wed, 24 Jun 2026 16:32:45 GMT, Andy Goryachev <[email protected]> wrote:

>> modules/jfx.incubator.richtext/src/main/java/jfx/incubator/scene/control/richtext/RichTextArea.java
>>  line 2529:
>> 
>>> 2527:             if (v) {
>>> 2528:                 cx.decorateRun(StyleAttributeMap.TEXT_HIGHLIGHT_1, 
>>> CellContext.RunDecor.HIGHLIGHT, Params.TEXT_HIGHLIGHT_1);
>>> 2529:             }
>> 
>> Since a developer could define their own highlight or wavy underline 
>> attribute like:
>>> INFO_HIGHLIGHT = new StyleAttribute<>( "INFO_HIGHLIGHT", Color.class, false 
>>> );
>> 
>> and want to add it to the _StyleHandlerRegistry_, it would be helpful if 
>> `decorateRun` was overloaded with a Color parameter:
>>> cx.decorateRun( INFO_HIGHLIGHT, CellContext.RunDecor.HIGHLIGHT, v );
>
> +1

On second thought, this will needlessly complicate things.

The only reason I had `RichParagraph.Builder.addHighlight(..., Color)` is to 
support a varying number of ad-hoc highlights generated programmatically.  To 
give you an example, a log viewer with 10-20 different tokens highlighted in 
different colors.

In this PR, we are adding a limited set of attributes to address 95% of most 
common use cases.

Since you simply want to use what looks like a single `INFO_HIGHLIGHT` 
attribute, you could either use the style name and your own stylesheet, or 
repurpose one of the standard `TEXT_HIGHLIGHT_*` with a custom stylesheet.

Does it make sense?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2196#discussion_r3469859721

Reply via email to