RichTextFX
RichTextFX copied to clipboard
choose ColorPicker update codearea text color
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();
}
}
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.