JavaFX borderpane fxml问题

时间:2017-08-10 07:53:08

标签: java fxml

我在JavaFX中做了一个应用程序而且我遇到了问题。问题出在第31行.BandnerPaneMain.fxm中的边框窗格有fx:id =" borderPane" Main.java:

public void start(Stage primaryStage) throws Exception {
    Locale.setDefault(new Locale("pl"));

    final String PATH = "/fxml/BorderPaneMain.fxml";

    FXMLLoader loader = new FXMLLoader(getClass().getResource(PATH));
    loader.setController(this);

    ResourceBundle bundle = ResourceBundle.getBundle("bundles.messages");
    loader.setResources(bundle);

    BorderPane borderPane = loader.load(); //this is line 31
    Scene scene = new Scene(borderPane);

    primaryStage.setScene(scene);

    primaryStage.setTitle(bundle.getString("tittle.app"));
    primaryStage.show();
}

错误:

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2597)
at javafx.fxml.FXMLLoader.access$100(FXMLLoader.java:103)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:914)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
at pl.karolkluczniok.facture.Main.start(Main.java:31)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)

BorderPaneMain.fxml:Link do fxml

Project structure

0 个答案:

没有答案