On Fri, 4 Oct 2024 18:23:41 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

> As a consequence of this, the following example from the `RichTextArea` class 
> docs (also found in the JEP) using a `SimpleViewOnlyStyledModel` with inline 
> CSS styles is no longer possible:
> 
> ```
>      SimpleViewOnlyStyledModel m = new SimpleViewOnlyStyledModel();
>      // add text segment using CSS style name (requires a style sheet)
>      m.addSegment("RichTextArea ", null, "HEADER");
>      // add text segment using direct style
>      m.addSegment("Demo", "-fx-font-size:200%;", null);
>      // newline
>      m.nl();
> 
>      RichTextArea textArea = new RichTextArea(m);
> ```
> 
> You will either need additional methods in `SimpleViewOnlyStyledModel` to 
> restore this functionality or rework the demo in the RTA docs (and JEP) to 
> not use CSS. I recommend the former unless there is a good reason you can't.

Oh _now_ I see what you did. You renamed them a while back, and I missed that. 
The following works, but I think the old names (or something similar) might be 
clearer. Is there a reason for the change? I don't remember seeing any 
discussion on it, nor did the code snippets in the RTA class docs and JEP get 
updated:


     SimpleViewOnlyStyledModel m = new SimpleViewOnlyStyledModel();
     // add text segment using CSS style name (requires a style sheet)
     m.withInlineAndExternalStyles("RichTextArea ", null, "HEADER");
     // add text segment using direct style
     m.withInlineStyle("Demo", "-fx-font-size:200%;");
     // newline
     m.nl();

     RichTextArea textArea = new RichTextArea(m);

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

PR Comment: https://git.openjdk.org/jfx/pull/1524#issuecomment-2394370006

Reply via email to