最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

intellij idea - javafx.embed.swing.JFXPanel import not working - Stack Overflow

programmeradmin3浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论