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!
javafx.scene.control.Dialiginstead of creating a new scene - Andrey M