Trying to call a JavaFX application from Java… NoSuchMethodException

谁说胖子不能爱 提交于 2019-11-27 09:18:59
assylias

You must provide a constructor with no arguments when you extend application. So you could do something like:

public class SimpleSun extends Application {

    private Stage primaryStage;
    Configuration configuration;

    public SimpleSun() {
        this.configuration = Main.getConfig();
    }
    //...

and in your Main class:

public static Configuration getConfig() { return new ConfigurationFromFile(); }

Alternatively you can pass String parameters to the class with launch(args) and get them back in the SimpleSun class with getParameters().

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!