admin管理员组

文章数量:1431927

I'm creating a project for school that requires me to use java swing and the api i chose has OAuth2 authentication so I decided that I could have one of my views have the browser embeded into it using JFX. For some reason though i've had trouble importing javafx.swing package into my project and the import javafx.embed.swing.JFXPanel; line does not recognize embed as a package available. I am using intellij IDEA with jdk 22 and I have javafx-swing version 23 loaded in as a dependency in my maven structure. Does anyone know if they changed the name of the package or if there's any other way to embed a browser into my java swing GUI. Any ideas would be appreciated.

    <dependency>
        <groupId>.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>20.0.2</version>
    </dependency>

    <dependency>
        <groupId>.openjfx</groupId>
        <artifactId>javafx-web</artifactId>
        <version>23</version>
    </dependency>

    <dependency>
        <groupId>.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>20.0.1</version>
    </dependency>

    <dependency>
        <groupId>.openjfx</groupId>
        <artifactId>javafx-swing</artifactId>
        <version>23</version> <!-- Add javafx-embed-swing -->
    </dependency>

I've tried changing versions in my maven dependency and i checked the documentation online to see if any name had changed to no avail.

EDIT-- The issue was that I was using different versions of JavaFX for all my JavaFX dependencies, changing them to ALL be version 20.0.1 seemed to work for me.

本文标签: intellij ideajavafxembedswingJFXPanel import not workingStack Overflow