0

I get javaFx css parse error while defining new variables in css.

It perfectly runs ok with a given constant like: -fx-font-size: 10;

Here is the code:

.root {
    tab-label-text-size: 10;
}
.label {
    -fx-font-size: tab-label-text-size;
}

Whatever I tried, I couldnt get rid of this exception. I also used other variables like this and they also run ok.

Expected '' while parsing '-fx-font-size' at [9,19]

Maybe a bug in javaFx??

2
  • This is not working only with colors. Commented May 28, 2019 at 15:55
  • Specifying your own properties works for colors only. You may be able to use the fact that the -fx-font-size property is inherited by default to your advantage tough. Commented May 28, 2019 at 16:12

1 Answer 1

2

In JavaFX CSS you can assign a color constant:

* {
    -color : #f44242;
}

.button {
    -fx-text-fill: -color;
}

But unfortunately, font size constants are not supported by the CssParser

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.