Began to write recently on JavaFX !
The task is this: by pressing the button on the main window, an additional window (Modal window) should be called!

A modal window should load with FXML !

Here is the class:

 public class OptionWindow { public void OptionWindow() throws IOException { Stage window = new Stage(); window.initModality(Modality.WINDOW_MODAL); AnchorPane pane = FXMLLoader.load(Main.class.getResource("option.fxml")); Scene scene = new Scene(pane, 300, 400); window.setScene(scene); window.setTitle("Настройка"); window.showAndWait(); } } 

Here is the error:

javafx.fxml.LoadException: /C:/Users/BillSwon/IdeaProjects/TestforWork/out/production/TestforWork/sample/option.fxml

Tell me what's the problem? You are welcome!

  • one
    It seems that you can not download option.fxml. Most likely you have a path to crookedly registered - Mikhail Rebrov
  • + look towards javafx.scene.control.Dialig instead of creating a new scene - Andrey M
  • The answer is found! The fact is that I made mistakes in the scene bilder! I wrote it all over again and everything became normal! - Artyom

0