Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choose ColorPicker update codearea text color #1180

Open
xiaofanku opened this issue Mar 25, 2023 · 1 comment
Open

choose ColorPicker update codearea text color #1180

xiaofanku opened this issue Mar 25, 2023 · 1 comment

Comments

@xiaofanku
Copy link

xiaofanku commented Mar 25, 2023

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();
    }
}
@Jugen
Copy link
Collaborator

Jugen commented Mar 27, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants