我遇到了一个我自己无法解决的问题,因为我刚刚开始使用JAVA FX.我得到一个令人讨厌的javafx.fxml.LoadException :,但我完全像一个向导,但我不能让我的Main运行.这是异常输出:
apr 07, 2014 4:06:37 EM application.Main start
ALLVARLIG: null
javafx.fxml.LoadException:
/C:/Users/Jakob/Dropbox/java_kurser/Project%20Timeline/bin/application/LoginGUI.fxml
at javafx.fxml.FXMLLoader.constructLoadException(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at application.Main.start(Main.java:21)
at com.sun.javafx.application.LauncherImpl$8.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$7.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(Unknown Source)
at com.sun.glass.ui.win.WinApplication$4$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.stream.XMLStreamException: ParseError …Run Code Online (Sandbox Code Playgroud) 我正在做一个时间表项目.我已经成功地为所有内容创建了一个登录系统和菜单,但是当我按下我已经完成的按钮时,它将打开一个新窗口(带有舞台,场景).我读过这不是最好的方法.最好的方法是只有1个主要阶段,而那个是我启动应用程序时的登录.
但我已经找到了有关一个阶段的多个场景的信息,但我还没有找到任何好的解决方案.真的很感激一些帮助;)希望你明白我想要实现的目标.值得一提的是,i =我正在处理Scenebuilder和fxml文件,所以我想要的主要是将新的.fxml场景加载到主舞台上.
所以我查看了另一个线程并尝试执行一个处理所有场景更改的VistaFramework.但我完全不了解它,我无法让它发挥作用.
package application;
import javafx.fxml.FXMLLoader;
import java.io.IOException;
import controllers.MainController;
/**
* Utility class for controlling navigation between vistas.
*
* All methods on the navigator are static to facilitate
* simple access from anywhere in the application.
*/
public class VistaNavigator {
/**
* Convenience constants for fxml layouts managed by the navigator.
*/
public static final String MAIN = "LoginGUI.fxml";
public static final String NEW_USER = "NewUserGUI.fxml";
public static final String STARTMENU = "StartMenuGUI.fxml";
/** The …Run Code Online (Sandbox Code Playgroud)