Displays the loaded FXML resource as a new JavaFX stage. @param title The title of the stage to be displayed. @throws IllegalStateException if this method is called outside the JavaFX application thread.
(String title)
| 65 | * @throws IllegalStateException if this method is called outside the JavaFX application thread. |
| 66 | */ |
| 67 | public void showAsStage(String title) |
| 68 | { |
| 69 | GuiAssertions.assertIsJavaFXThread(); |
| 70 | |
| 71 | try |
| 72 | { |
| 73 | // Load the scene from the FXML resource. |
| 74 | Scene scene = fxmlLoader.load(); |
| 75 | |
| 76 | // Create and configure a new stage. |
| 77 | Stage stage = new Stage(); |
| 78 | stage.setTitle(title); |
| 79 | stage.setScene(scene); |
| 80 | stage.sizeToScene(); |
| 81 | stage.show(); |
| 82 | } catch (IOException e) |
| 83 | { |
| 84 | LOG.log(Level.SEVERE, |
| 85 | MessageFormat.format("Failed to load stream fxml from location {0})", fxmlLoader.getLocation()), |
| 86 | e); |
| 87 | } |
| 88 | } |
| 89 | } |
no test coverage detected