RichTextArea: how to set wavy underline using CSS?
Andy Goryachev
andy.goryachev at oracle.com
Mon Apr 28 15:36:14 UTC 2025
An interesting question.
Currently, the shape for a wavy underline is created programmatically, see HighlightShape::generateSquiggly(). It is unclear how to enable CSS styling - for example, the model may decide to provide more than one color. It is also unclear how to generate the necessary path via CSS (it is currently a Path with a sawtooth line segments generated from the underline shape provided by the text layout).
If you are satisfied with the wavy line shape itself and just want to set the color via CSS - that should be easy (you just identified a missing API - there is RichParagraph.Builder.addWavyUnderline(int start, int end, Color color), but not RichParagraph.Builder.addWavyUnderline(int start, int end, String ... styles).
And we have a similar situation with the similar method RichParagraph.Builder.addHighlight().
Could you describe your use case in more detail please?
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com>
Date: Sunday, April 27, 2025 at 11:27
To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
Subject: RichTextArea: how to set wavy underline using CSS?
RichParagraph.Builder has public RichParagraph.Builder addWavyUnderline(int start, int length, Color color) method.
However, I can't find a way how to make a wavy underline via CSS. It is very important for me because I want to make all styling via CSS -
I don't want to make users use different mechanisms for styling (CSS, code).
Fox example, RichTextFX contains the following rules:
/* the color of the underline */
-rtfx-underline-color: <paint>;
/* the radius used to create waved underline */
-rtfx-underline-wave-radius: <size>;
Could anyone say how to do it in JFX RichTextArea?
Best regards, Pavel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250428/870651cf/attachment.htm>
More information about the openjfx-dev
mailing list