Here was my original post:
I have an application built in NetBeans 8/ Java8/JavaFX. (Note that I do not have SceneBuilder)
My main application window is running fine. I have a menu item that calls the following function to open a second window:
@FXML
private void openChildWindowAlt() throws Exception {
Group root = new Group();
Stage stage = new Stage();
AnchorPane frame = FXMLLoader.load(getClass().getResource("fxml_childWindow1.fxml"));
root.getChildren().add(frame);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
When I select the menu button, my 2nd stage shows up as expected, but I get the following exception:
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:56)
at java.awt.AWTEvent.<init>(AWTEvent.java:337)
at sun.awt.UngrabEvent.<init>(UngrabEvent.java:48)
at javafx.embed.swing.SwingNode$10.handle(SwingNode.java:414)
at javafx.embed.swing.SwingNode$10.handle(SwingNode.java:410)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:204)
....there's more, lots more... hopefully this is enough for someone to help.
I have also tried the following, which results in the same exception:
@FXML private void openChildWindow() throws Exception {
Stage stage = new Stage();
AnchorPane root = new AnchorPane();
TabPane myTabPane = new TabPane();
Tab tab1 = new Tab("blue");
Tab tab2 = new Tab("purple");
myTabPane.getTabs().addAll(tab1,tab2);
root.getChildren().add(myTabPane);
stage.setScene(new Scene(root,1200,800));
stage.show();
}
After posting the above, I went back to the application and realized that I get this exception not only when I open these windows, but on ANY click of ANY menu item, no matter what the menu item does.
Any ideas?
Thanks!
-Adeena