是否可以使用IntelliJ插件启动.fxml(javafx资源文件)?
如果有人可以分享任何样品,我将不胜感激 感谢
答案 0 :(得分:0)
公共类NewTestDlg {
final JFXPanel fxPanel = new JFXPanel();
Stage stage;
public void ShowDialog() {
Platform.setImplicitExit(false);
// create JavaFX scene
PlatformImpl.startup(() -> {
Parent root;
try {
stage = new Stage();
stage.setTitle("New Test");
BorderPane pane = new BorderPane();
FXMLLoader loader = new FXMLLoader(getClass().getResource("NewTestDlg.fxml"));
loader.setClassLoader(this.getClass().getClassLoader());
root = (Parent) loader.load();
Scene scene = new Scene(root, 610, 345);
fxPanel.setScene(scene);
stage.setScene(scene);
stage.show();
} catch (Exception ex) {
System.err.println(ex.getMessage());
System.err.println("Exception in ShowDialog");
ex.printStackTrace();
}
});
}
}