Skip to main content

Opening New Windows, Switching Scenes, Modal Windows and Window Events

Learn Opening New Windows, Switching Scenes, Modal Windows and Window Events (Phase 9 · Navigation and Windows (Core), JavaFX) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Opening new windows • Create another Stage with its own Scene and call show() ; set owner ( initOwner(parent) ) and modality ( initModality(Modality.APPLICATION_MODAL | WINDOW_MODAL | NONE) ) before showing; showAndWait() blocks the caller until the window closes (nested event loop) and is perfect for modal forms that return a result. Position relative to the owner, set a title and icon.

More lessons in Phase 9 · Navigation and Windows (Core)