简体   繁体   中英

JavaFX CSS Files don't autocomplete in Eclipse

I am making a JavaFX Application and want to use stylesheets. I don't work directly with the Scene Builder tool (although I set it up: downloaded Scene Builder and added Eclipse plugin "e(fx)clipse").

In Eclipse I just started a normal Project ( File > New > Java Project ). I created a file "style.css" by right clicking on a package > New > File .

As an example for my style.css file:

.root {
    -fx-font: 16px "Serif";
    -fx-padding: 10;
    -fx-background-color: #CCFF99;
}

When I edit this file I want to have the eclipse autocomplete and "suggestion" feature enabled. But when I press "Ctrl + Space" it doesn't show any suggestions. How to fix this?

Edit:

As suggested in the 'possible duplicate link' How to add CSS autocomplete to eclipse . I tried the following (without any success):

Went to Window -> Preferences -> General -> Content Types -> Text -> Java Source File -> Add (*.css) (added *.css, but autocomplete still fails)

Went to Window -> Preferences -> General -> Editors -> File Association -> Add ( .css) ( .css was already in here...)

The other are JSP related and I have no Idea what they are talking about. Any suggestions to solving this?

The project needs to have the JavaFX Classpath container

  • Open the properties of the project
  • Go to Java Build Path
  • Select Libraries Tab
  • Click Add Library
  • Select JavaFX SDK

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