Skip to content

JDK 11 / OpenJFX 11 no CSS autocomplete and “Unknown property” warning #75

@mininotallarines

Description

@mininotallarines

My css autocomplete doesn't work and I get "unknown property" warnings. I've tried a lot already but nothing seems to work. I even reinstalled eclipse, removed all the plugins, and reinstalled all of them. I created new workspaces, new projects, ... Nothing works.

My Environment

Eclipse 2020-03 (4.15.0)

Windows 10 (1903)

Java JDK 11.0.7

What I did

  1. Created a new Maven project (JavaSE-11)

  2. Added OpenJFX as dependency in the pom file

  3. Made sure the Maven dependencies are on the classpath since I don't want to use the module system

  4. Added the JavaFX SDK library to the classpath

  5. Downloaded the OpenJFX libraries and point JavaFX 11 + SDK path in preferences to the path I installed it to (C:\Program Files\OpenJFX\javafx-sdk-11.0.2\lib)

  6. Write a test class using the JavaFX libraries (which works)

  7. Create a css file to style my application which adds the xtext nature (and open it with the e(fx)clipse css editor)

So I can use the JavaFX libraries and I can launch my application without any errors. But I can't use the css autocomplete feature because all properties are unknown and this causes warnings.

My POM file

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.company</groupId>
  <artifactId>FXProject</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <release>11</release>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
  	<dependency>
  		<groupId>org.openjfx</groupId>
  		<artifactId>javafx-controls</artifactId>
  		<version>11.0.1</version>
  	</dependency>
  </dependencies>
</project>

My CSS file (application.css)

.root {
	-fx-background-color: red;
}

Launcher class (main class)

import javafx.application.Application;

public class Launcher {
	
	public static void main(String[] args) {
		Application.launch(TestApp.class);
	}
	
}

TestApp class

import javafx.application.Application;
import javafx.stage.Stage;

public class TestApp extends Application {
	
	@Override
    public void start(Stage primaryStage) {
	    try {
		    BorderPane root = new BorderPane();
		    Scene scene = new Scene(root,400,400);
		    scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
		    primaryStage.setScene(scene);
		    primaryStage.show();
	    } catch(Exception e) {
		    e.printStackTrace();
	    }
    }
	
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions