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

How to set the font and font-size of a CodeArea #103

Closed
nkolban opened this issue Dec 22, 2014 · 2 comments
Closed

How to set the font and font-size of a CodeArea #103

nkolban opened this issue Dec 22, 2014 · 2 comments

Comments

@nkolban
Copy link

nkolban commented Dec 22, 2014

I am wanting to use this package to show some JavaScript code. I wished to change the font and font-size for my CodeArea control and coded:

    codeArea = new CodeArea();
    codeArea.setFont(Font.font("consolas", 11.0));
    codeArea.setParagraphGraphicFactory(LineNumberFactory.get(codeArea));

However, when the control is shown, the font doesn't change but the size is fine however the moment I type a character, the font size changes back to the default. I think I am missing how to set the font for the control as a whole. Would you be able to advise?

@janghyunq
Copy link

Use setStyle() method.

@nkolban
Copy link
Author

nkolban commented Dec 23, 2014

Thank you ... that worked great. My end result was:

    codeArea.setStyle("-fx-font-family: consolas; -fx-font-size: 11pt;");

@nkolban nkolban closed this as completed Dec 23, 2014
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