[External] : RichTextArea styling feedback

Jurgen Doll jurgen at ivoryemr.co.za
Wed Aug 27 06:52:15 UTC 2025


Whoops, my bad - trying to respond quickly before going to sleep.

However even here both embedded attributes and inline styles should be allowed as the embedded attributes don't cover all possible CSS attributes. I actually used a "-fx-effect" style in my experimentation with RichTextArea to indicate misspelled words. Another benefit to allowing this is that if it would enable the use of any future CSS attributes that may be added without having to change RichTextArea.
Granted attribute duplication is possible so maybe throwing an exception is an option or just noting it in the JavDoc ?
Btw if I'm not mistaken adding INLINE_STYLE and STYLE_NAMES would probably do way with the need for the CssStyles class.
Regards
Jurgen

On Aug 26 2025, at 9:41 pm, Andy Goryachev <andy.goryachev at oracle.com> wrote:
> What I meant is if you try to mix embedded styles (such as StyleAttributeMap.BOLD for instance) and explicit inline styles (such as "-fx-font-weight"), the result is unpredictable because they both try to set inline style when rendering paragraphs.
>
> So the model must either provide embedded attributes (BOLD), or inline styles, but not both. Style names can be used in both cases, since inline styles have higher priority.
>
> -andy
>
>
>
> From: Jurgen Doll <jurgen at ivoryemr.co.za>
> Date: Tuesday, August 26, 2025 at 12:34
> To: Andy Goryachev <andy.goryachev at oracle.com>, openjfx-discuss at openjdk.org <openjfx-discuss at openjdk.org>
> Subject: Re: [External] : RichTextArea styling feedback
>
> Hi Andy
>
> I think they should both be allowed at the same time, with a reminder in the JavaDoc that the same rules apply as usual styling using setStyle and getStyleClass. In my own application I generally use the latter by default but I do also sometimes mix it with setStyle. If I remember correctly the rule is that CSS attributes set via setStyle overrides any of those attributes that were specified via a style class. So I don't think there's a need to make them mutually exclusive.
>
> Regards
> Jurgen
>
> On Aug 26 2025, at 9:01 pm, Andy Goryachev <andy.goryachev at oracle.com> wrote:
>
> > Thanks! A though was nagging at me to basically fold the CSS style names into an attribute like you suggested. The main reason I decided to hide it was that the two styling methods (css vs embedded attributes) are two separate, almost mutually exclusive modes.
> >
> > In fact, the embedded styles end up as inline styles, so it makes little sense to allow both to be active at the same time, as there is no way to guarantee the end result.
> >
> > Nevertheless, it's a good opportunity to give it another thought.
> >
> > Thanks!
> > -andy
> >
> >
> > From: Jurgen Doll <jurgen at ivoryemr.co.za>
> > Date: Tuesday, August 26, 2025 at 11:46
> > To: Andy Goryachev <andy.goryachev at oracle.com>
> > Subject: Re: [External] : RichTextArea styling feedback
> >
> > Hi Andy
> >
> > In RichParagraph.Builder there is addWithInlineStyle which maps to Node.setStyle( String ), and then also addWithStyleNames which maps to Node.getStyleClass().add( String ).
> >
> > Yes, they're mapped to CssStyles and can stay a hidden implementation detail.
> >
> > Regards
> > Jurgen
> >
> > On Aug 26 2025, at 8:31 pm, Andy Goryachev <andy.goryachev at oracle.com> wrote:
> > > Dear Jurgen:
> > >
> > > Thanks again for the feedback, here are the new JBS tickets:
> > >
> > > JDK-8366198 (https://bugs.openjdk.org/browse/JDK-8366198) RichTextArea: consider new attributes in StyleAttributeMap (INLINE_STYLE, STYLE_NAMES, TEXT_HIGHLIGHT, and WAVY_UNDERLINE)
> > > JDK-8366201 (https://bugs.openjdk.org/browse/JDK-8366201) RichTextArea: add undo parameter to applyStyle/setStyle
> > > JDK-8366202 (https://bugs.openjdk.org/browse/JDK-8366202) RichTextArea: wrong style used for typed text
> > >
> > > Question - what exactly do you mean by INLINE_STYLE?
> > >
> > > I assume STYLE_NAMES are basically the public equivalent of CssStyles.CSS (which I decided to hide as an implementation detail in the first iteration)?
> > >
> > > Thanks!
> > > -andy
> >
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-discuss/attachments/20250827/40135221/attachment.htm>


More information about the openjfx-discuss mailing list