Java FX FXML应用程序无法启动 - 没有错误消息

时间:2017-03-02 15:01:29

标签: javafx fxml

让我感到困惑

它编译运行但没有打开屏幕! 没有错误消息

我只需要打开FXML表单。

我正在犯一个新的错误?

package za.co.zone.ffefx.views;

import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

/**
 * @author Morons
 */
public class Main extends Application {

    @Override
    public void start(Stage stage) throws Exception {
        try {
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(Main.class.getResource("CustomerMainFXML.fxml"));
            AnchorPane root = (AnchorPane) loader.load();
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.setTitle("Customer Management");
            stage.getIcons().add(new Image(Main.class.getResourceAsStream("img/ico.png")));
            stage.setResizable(false);
            stage.sizeToScene();
            stage.show();
        } catch (IOException e) {
            e.getMessage();
        }
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

}

0 个答案:

没有答案