Java Code Examples for javafx.stage.Stage#fireEvent()
The following examples show how to use
javafx.stage.Stage#fireEvent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorkbenchTest.java From WorkbenchFX with Apache License 2.0 | 5 votes |
/** * Internal utility method for testing. * Simulates closing the stage, which fires a close request to test logic * inside of {@link Stage#setOnCloseRequest(EventHandler)}. * Using {@link FxRobot#closeCurrentWindow()} would be better, but it only works on Windows * because of its implementation, so this approach was chosen as a workaround. * @see <a href="https://github.com/TestFX/TestFX/issues/447"> * closeCurrentWindow() doesn't work headless</a> */ private void closeStage() { Stage stage = ((Stage) workbench.getScene().getWindow()); stage.fireEvent( new WindowEvent( stage, WindowEvent.WINDOW_CLOSE_REQUEST ) ); }
Example 2
Source File: ImportPcapWizardController.java From trex-stateless-gui with Apache License 2.0 | 4 votes |
/** * Close import dialog */ private void closeDialog() { Stage currentStage = (Stage) wizardViewContainer.getScene().getWindow(); currentStage.fireEvent(new WindowEvent(currentStage, WindowEvent.WINDOW_CLOSE_REQUEST)); }