Sinisterly
FXML problems when open a new Stage Scene..! - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Java, JVM, & JRE (https://sinister.ly/Forum-Java-JVM-JRE)
+--- Thread: FXML problems when open a new Stage Scene..! (/Thread-FXML-problems-when-open-a-new-Stage-Scene)

Pages: 1 2


FXML problems when open a new Stage Scene..! - Hu3c0 - 08-11-2016

Hello brothers  first of all I apreciated the post from @Ex094  he open my eyes  to create amazing gui's with FX Scene Builder.
Now I 'm  codding a program for Web Masters  and I'got a problem when I open a new Stage.

I've got  three fxml  one for the main , the second fxml has  two label (with imageviews) , the thirds fxml only has and Webview

For the label I had create  onmouseClicked method  it looks like this
@FXML
   private void openIconFinder(MouseEvent event) throws IOException {
       try {
       FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FXMLIcon_Finder.fxml"));
               Parent root1 = (Parent) fxmlLoader.load();
               Stage stage = new Stage();          
               stage.setScene(new Scene(root1));  
               stage.show();
       } catch(Exception e) {
          e.printStackTrace();
   
   }
}
okey,  as you can see as I want is open a new Stage  including in its the Scene created in my "FXMLIcon_Finder.fxml". but
for some reasons i cann't understand  why doesn't works for me

[Image: 241se2x.png]

In my Webview java controler  class the code is :

public class FXMLWebViewController implements Initializable {
   @FXML
   private WebView webview;

   /**
    * Initializes the controller class.
    */
   @Override
   public void initialize(URL url, ResourceBundle rb) {
      webview.getEngine().load("https://www.google.com");
   }    
   
Thanks for read me and  for your time


RE: FXML problems when open a new Stage Scene..! - Ex094 - 08-11-2016

Thanks Smile

About the problem, Are you sure the .fxml file is in the same package as your main controller?

Location is not set means that you have not provided a valid path to your .fxml file and remember file names are case sensitive too so check that just in case


RE: FXML problems when open a new Stage Scene..! - Hu3c0 - 08-11-2016

Yes it's brother i attach an image project
[Image: 552rg5.png]

From the SceneController I call FXMLIconFinder as you apreciate it's in the same packege I'm very ofuscated with this I cann't foward with my project.


RE: FXML problems when open a new Stage Scene..! - Ex094 - 08-11-2016

Try CLEAN AND BUILD on the project and then run it again, then report back


RE: FXML problems when open a new Stage Scene..! - Hu3c0 - 08-11-2016

I did it and the same result


RE: FXML problems when open a new Stage Scene..! - Ex094 - 08-11-2016

I see your .fxml file name is different than the one you put in your file "FXMLIcon_Finder.fxml" or did you changed it just now?


RE: FXML problems when open a new Stage Scene..! - Mr.Kurd - 08-11-2016

i have question what is FXML ?
Expalin it to me pls!
And you use java yes? Wich IDE you use?


RE: FXML problems when open a new Stage Scene..! - Ex094 - 08-11-2016

This is definitely a problem with the path that you are providing, Also try this:
Code:
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Scenes/FXMLIconFinder.fxml"));

@Mr.Kurd Check out my tutorial on JavaFX https://sinister.ly/Thread-Tutorial-JavaFX-Series-PART-1-Setting-up-NetBeans-for-JavaFX-Development


RE: FXML problems when open a new Stage Scene..! - Mr.Kurd - 08-11-2016

thank buddy really thank.

thank buddy really thank i read it all with my matmatic. Hhhh


RE: FXML problems when open a new Stage Scene..! - Hu3c0 - 08-11-2016

(08-11-2016, 07:01 PM)Ex094 Wrote: This is definitely a problem with the path that you are providing, Also try this:
Code:
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Scenes/FXMLIconFinder.fxml"));

@Mr.Kurd Check out my tutorial on JavaFX https://sinister.ly/Thread-Tutorial-JavaFX-Series-PART-1-Setting-up-NetBeans-for-JavaFX-Development



No  it isn't  the reasons  look at the  image

[Image: f3zfa.png]

[Image: vfh3ma.png]

What can be the problem...?   I'm figthing with it three days. For first time i was wondering the same  of you the fxml path.
One think more if you see the image in the code there is a method call it base64Method and its works