0

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.

5
  • What does "___" usually say? Commented Dec 14, 2019 at 19:56
  • 2
    Can you add the CSS file(s) to the scene graph without issue? If so, then this is probably just a problem with your IDE. Have you tried installing e(fx)clipse? Commented Dec 14, 2019 at 20:06
  • do what Slaw suggested and also edit your buildpath to include javafx, to enable jfx-css code-assistance Commented Dec 14, 2019 at 21:47
  • I have e(fx)clipse installed and working, (except this part obviously). "___" says the rule I attempted to use: Ex. "no rule for -fx-font-family found!" Commented Dec 14, 2019 at 23:36
  • 1
    minimal reproducible example please .. Commented Dec 15, 2019 at 6:17

1 Answer 1

1

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

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.