简体   繁体   中英

WARNING: CSS Error parsing

I am trying to create a GUI in JavaFx. My problem is that I am receiving warning with my CSS style. In fact my warnings are:

WARNING: CSS Error parsing ' {-fx-font: 90 Langdon; -fx-base: #AE3522; -fx-text-fill: white; bold;}: WARNING: CSS Error parsing ' {-fx-font: 60 Langdon; -fx-text-fill: white; bold; -fx-base: #AE3522 bold;}:

This CSS is assignig to my buttons and Labels:

learnin = new Label(" Puzzle ");
learnin.setStyle("-fx-font: 90 Langdon; -fx-base: #AE3522; -fx-text-fill: white; bold;");

Try it like this ...

learnin.setStyle("-fx-font: 90 Langdon; "
                + "-fx-base: #AE3522; "
                + "-fx-text-fill: white; "
                + "-fx-font-weight:bold;");

... or shorter ...

learnin.setStyle("-fx-font: normal bold 90 Langdon; "
                + "-fx-base: #AE3522; "
                + "-fx-text-fill: white;");

This part is invalid: -fx-text-fill: white; bold; -fx-text-fill: white; bold;

You can check the JavaFX CSS Reference to check how you can style fonts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM