简体   繁体   中英

CSS not finding JavaFX rules

I am currently trying to style my JavaFX project with CSS, and each time I try to implement a property, it says "no rule for ___ found!". I have tried -fx-font-family: and -fx-background-color:.

I am using Eclipse 2019-09.

EDIT: Minimal Reproductive Example: application.css in a JavaFX project in Eclipse 2019-09

.label { -fx-font-family: Helvetica; }

Shows the message "no rule for -fx-font-family found!" and underlines the -fx-font-family line in yellow.

I had the same issue. Auto-completion was not working in JavaFx-Projects' css files.

I am using: openJDK12.0.2 and openjfx-sdk-11

The Problem is that e(fx)clipse requires this file in the build path. /.p2/pool/plugins/org.eclipse.fx.ide.css.jfx8_3.5.0.201907240300.jar

Earlier versions automatically added a JavaFX-Library (which included this jar) to your JavaFX-Project.

For using openjfx-sdk-11 you need to define a User Library anyways. I called it JavaFX11. Add all the JavaFX. *.jars there and also the **org.eclipse.fx.ide.css.jfx8_3.5.0.201907240300.jar.

Having a modularised project, you need to rename the file to some name, where the module system can derive a module name from. Ergo: org.eclipse.fx.ide.css.jfx8.jar

Now, auto-completion should work for all JavaFX-Projects where you used the JavaFX11-User-Library again!

Hope that helps. Johannes

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