i have a problem , i'm trying to open a popUp window with javaFX , in netbeans , work fine , but after trying the jar files it doesn't show , after running with cmd , i get this error ,
Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException:
Location is not set.
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at frame.login.LoginController.showPopupWindow(LoginController.java:144)
at frame.login.LoginController.lambda$initialize$0(LoginController.java:
114)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unkn
own Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(U
nknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Node.fireEvent(Unknown Source)
at javafx.scene.control.Button.fire(Unknown Source)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Un
known Source)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown S
ource)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown S
ource)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.h
andleBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unkn
own Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(U
nknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Scene$MouseHandler.process(Unknown Source)
at javafx.scene.Scene$MouseHandler.access$1500(Unknown Source)
at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotificatio
n.run(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotificatio
n.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEve
nt$354(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown
Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unkn
own Source)
at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
at com.sun.glass.ui.View.notifyMouse(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
at java.lang.Thread.run(Unknown Source)
showPopupWindow() to show the popup :
@FXML
private void showPopupWindow() {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("Popup.fxml"));
// initializing the controller
PopUpController popupController = new PopUpController();
loader.setController(popupController);
Parent layout;
try {
layout = loader.load();
Scene scene = new Scene(layout);
// this is the popup stage
Stage popupStage = new Stage();
// now
popupController.setStage(popupStage);
if(this.main!=null) {
popupStage.initOwner(main.getPrimaryStage());
}
popupStage.initModality(Modality.WINDOW_MODAL);
popupStage.setScene(scene);
popupStage.showAndWait();
} catch (IOException e) {
e.printStackTrace();
new Alert(Alert.AlertType.ERROR, "There was an error trying to load the popup fxml file.").show();
}
}
}