[英]Missing SwingInterOpUtils when running JavaFx in an Swing application build with Maven
我有一個 Swing 應用程序,我想將 JavaFx 集成到它。 從 Eclipse 啟動時,應用程序運行良好。
這是主要課程:
package org.openjfx.hellofx;
import java.awt.BorderLayout;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Scene;
import javax.swing.JFrame;
public class AppRun {
public static void main(String[] args) {
JFrame f = new JFrame("TEST");
f.setSize(400, 400);;
f.getContentPane().setLayout(new BorderLayout());
JFXPanel panel = new JFXPanel();
Scene s = new Scene(new javafx.scene.control.Label("JavaFx"));
panel.setScene(s);
f.getContentPane().add(panel);
f.setVisible(true);
}
}
我不知道您是否正在創建模塊化應用程序,但我認為您應該考慮使用javafx-maven-plugin
而不是maven-shade-plugin
來生成應用程序的自定義本機映像。 您已經包含了插件,只需運行mvn clean javafx:jlink
。 檢查插件的 GitHub README 以獲取配置詳細信息: https ://github.com/openjfx/javafx-maven-plugin
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.