RichTextFX icon indicating copy to clipboard operation
RichTextFX copied to clipboard

choose ColorPicker update codearea text color

Open xiaofanku opened this issue 1 year ago • 1 comments

my controller code is

public class HelloController
{
    @FXML private ColorPicker fontColorSelect;
    @FXML private CodeArea editor;
    @FXML private AnchorPane editbox;

    @FXML protected void chooseFontColor(ActionEvent event)
    {
        Color c = fontColorSelect.getValue();
        // choose ColorPicker update codearea text color?
        // this.editor.setStyle();
    }
}

xiaofanku avatar Mar 25 '23 08:03 xiaofanku

The problem here is that CodeArea is an extension of StyleClassedTextArea which as the class name says uses style classes in a CSS file to do any styling.

I don't know of a way to do on the fly custom styling using style classes, so the alternative is to take CodeArea and extend it off of InlineCssTextArea instead, which will then allow you to apply on the fly custom styling.

You could also try asking on StackOverflow if anybody knows how to change and apply a CSS file on the fly.

Jugen avatar Mar 27 '23 07:03 Jugen