RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights
Andy Goryachev
angorya at openjdk.org
Thu May 8 17:46:09 UTC 2025
Adding missing APIs related to styling the highlights with CSS:

Adds methods to the `RichParagraph.Builder`:
/**
* Adds a wavy underline (typically used as a spell checker indicator) with the specified style name(s).
* <p>
* The corresponding styles should define CSS properties applicable to {@link javafx.scene.shape.Path}.
*
* @param start the start offset
* @param length the end offset
* @param css the style name(s)
* @return this {@code Builder} instance
* @since 25
*/
public Builder addWavyUnderline(int start, int length, String ... css) {
/**
* Adds a highlight with the specified style name(s).
* Use translucent colors to enable multiple highlights in the same region of text.
* <p>
* The corresponding styles should define CSS properties applicable to {@link javafx.scene.shape.Path}.
*
* @param start the start offset
* @param length the end offset
* @param css the style name(s)
* @return this {@code Builder} instance
* @since 25
*/
public Builder addHighlight(int start, int length, String ... css) {
Also adding similar methods to the `SimpleViewOnlyStyledModel` class:
/**
* Adds a highlight of the given color to the specified range within the last paragraph,
* with the specified style name(s).
*
* @param start the start offset
* @param length the length of the highlight
* @param css the highlight style name(s)
* @return this model instance
* @since 25
*/
public SimpleViewOnlyStyledModel highlight(int start, int length, String ... css) {
/**
* Adds a wavy underline (typically used as a spell checker indicator)
* to the specified range within the last paragraph, with the specified style name(s).
*
* @param start the start offset
* @param length the length of the highlight
* @param css the highlight style name(s)
* @return this model instance
* @since 25
*/
public SimpleViewOnlyStyledModel addWavyUnderline(int start, int length, String ... css) {
-------------
Commit messages:
- tab
- css
Changes: https://git.openjdk.org/jfx/pull/1802/files
Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1802&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8355774
Stats: 128 lines in 4 files changed: 110 ins; 8 del; 10 mod
Patch: https://git.openjdk.org/jfx/pull/1802.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1802/head:pull/1802
PR: https://git.openjdk.org/jfx/pull/1802
More information about the openjfx-dev
mailing list