Sunday, 15 April 2012

java - JavaFX Location is not set error message -


I have a problem while trying to close the current problem and when the menu item is selected, open another view. My main step is coded down:

  Public Zero Start (Stage Primary Stage) throws exceptions {primaryStage.setTitle ("Shop Management"); FXML loader myLoader = new FXML loader (getClass (). GetResource ("cartHomePage.fxml")); Panel myPane = (panel) myLoader.load (); CarthomPage UI Controller = (CarthomPage UI) myLoader.getController (); Controller.setPrevStage (primaryStage); View myScene = new view (myPane); PrimaryStage.setScene (myScene); PrimaryStage.show (); }   

When the program is executed, it will go to the car. home page. FxL From there, when I select the menu item, I can choose to create or create a product. Here is my action program:

  Stage Priestage; Public Zero Setprovvast (Stage Stage) {this.prevStage = stage; } Public Zero Gotocrat Range (Action Event Event) throws IOException {Stage Stage = New Phase (); Stage.setTitle ("Shop Management"); FXMLLoader myLoader = new FXML loader (getClass (). GetResource ("createcategory.fxml")); Panel myPane = (panel) myLoader.load (); Visual view = new view (myPane); Stage.setScene (view); PrevStage.close (); SetPrevStage (forum); stage show(); } // method to change the method when the menu item creates the product @ FXML throws the public Zero Gotokrite product (ActionEvent event) IOException {step step = new step (); Stage.setTitle ("Shop Management"); FXMLLoader myLoader = New FXMLLoader (getClass (). GetResource ("creatProduct.fxml")); Panel myPane = (panel) myLoader.load (); Visual view = new view (myPane); Stage.setScene (view); PrevStage.close (); SetPrevStage (forum); stage show(); }   

However, I can only turn the forum once. For example, my default page is cartHomePage.fxml when I run the program, first I'm going to create product stages. After that, I can not go anywhere The error message is:

  java.lang.IllegalStateException: location is not set. And tap pointer exception   

After setting it off, I had set up the platform and passed it. I wonder what part went wrong.

Thanks in advance.

I had this problem and found this post. My problem was just a file name problem.

  FaxMLLoader (GetClass (). GetResource ("/ com / companyname / report /" + report.getClass (). GetCanonicalName (). Substring (18) .replaceAll ("Controller", " ") +" .fxml ")); Original root = (parent) loader.load ();   

I have an XML that is coming from all of these and I want to make sure that my class is same as the fxml file is less than the word controller.

I messed up the sub-code, so the path was wrong ... I decided that I had fixed the name of the file.

To reduce the long story, I think the problem is either the name of the file name is incorrect or the path is wrong.

No comments:

Post a Comment