JetBrains / lets-plot-kotlin

Grammar of Graphics for Kotlin
https://lets-plot.org/kotlin/
MIT License
430 stars 36 forks source link

JavaFX demo does not compile #40

Closed veyndan closed 3 years ago

veyndan commented 3 years ago

I was trying to run and compile the JavaFX minimalDemo (as referenced here) but have received a type mismatch exception.

e: /Users/v.stuart/IdeaProjects/lets-plot-kotlin/demo/jvm-javafx/src/main/kotlin/minimalDemo/Main.kt: (56, 69): Type mismatch: inferred type is (SvgSvgElement) -> SceneMapperJfxPanel but (SvgSvgElement) -> JComponent was expected
alshan commented 3 years ago

Are you able to build the demos using ./gradlew :jvm-javafx:build command in the command line?

IMO should not be any issues here because SceneMapperJfxPanel inherits JComponent via javafx.embed.swing.JFXPanel. I'm using jdk 1.8 with javafx bundled.

veyndan commented 3 years ago

Thanks for looking into this 😄 I had forgotten to mention that I was using OpenJDK 1.8 and was using the OpenJFX Gradle plugin (which probably would've been useful to include in my original comment). The issue was indeed to do with my JavaFX set up.

In case anyone faces the same issue, my Gradle script was originally:

javafx {
    version = "14"
    modules = ['javafx.controls', 'javafx.graphics']
}

But I needed to include the javafx.swing module to get this to work:

javafx {
    version = "14"
    modules = ['javafx.controls', 'javafx.graphics', 'javafx.swing']
}