简体   繁体   English

使用Intellij的JavaFX的SceneBuilder不会将代码加载到我的fxml文件中

[英]SceneBuilder with JavaFX using Intellij won't load the code to my fxml file

Figure.1 图1

Figure.2 图2

I'm having problem loading my code to my fxml file even tho they have the same filename.The code won't automatically add to my fxml file when I put those 3 buttons.(See Figure.1). 我无法将代码加载到我的fxml文件中,即使它们具有相同的文件名也是如此。当我按下这三个按钮时,代码不会自动添加到我的fxml文件中(见图1)。 I didn't open the scenebuilder inside of my intellij becase of having that error(See figure.2) thus, I right clicked 'SceneBuilderProject.fxml' and clicked 'Open in SceneBuilder'. 出现此错误时,我没有在我的Intellij内部打开SceneBuilder(请参见图2)。因此,我右键单击“ SceneBuilderProject.fxml”,然后单击“在SceneBuilder中打开”。 Any suggestion to verify the path from scenebuilder to the javafx i'm working with? 有什么建议可以验证从scenebuilder到我正在使用的javafx的路径吗?

java.lang.ClassNotFoundException: com.sun.javafx.fxml.LoadListener PluginClassLoader[org.jetbrains.plugins.javaFX, 192.5728.98] com.intellij.ide.plugins.cl.PluginClassLoader@3104190

java.lang.NoClassDefFoundError: com/sun/javafx/fxml/LoadListener

    com.intellij.diagnostic.PluginException: While loading class com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader: com/sun/javafx/fxml/LoadListener [Plugin: org.jetbrains.plugins.javaFX

Above is the actual error from figure.2 以上是图2的实际错误

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
        Parent root = FXMLLoader.load(getClass().getResource("SceneBuilderProject.fxml"));
        primaryStage.setTitle("SceneBuildProject");
        primaryStage.setScene(new Scene(root, 300, 275));
        primaryStage.show();
    }


    public static void main(String[] args) {
        launch(args);
    }
}

Above is the Main Class. 以上是主要班级。

Use: 使用:

FXMLLoader.load(getClass().getResource("src/SceneBuildPackage/SceneBuilderProject.fxml"));

instead of: 代替:

FXMLLoader.load(getClass().getResource("SceneBuilderProject.fxml"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM