Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8210921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:14:50+00:00 2026-06-07T10:14:50+00:00

My test app’s flow uses multiple screens : start(Stage stage) -> Screen 1 ->

  • 0

My test app’s flow uses multiple screens :

start(Stage stage) -> Screen 1
                   -> Screen 2
                   -> ...

I want to implement some of my screens in fxml, but can’t figure what’s the best practise way to switch between them.

How can i implement some quit-event mechanism in the screen 1 controller, when screen 1 reached its final state, and connect it to the “main loop” to delete screen 1 and update the scene with screen 2 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:14:53+00:00Added an answer on June 7, 2026 at 10:14 am

    In my opinion, the best way to do it is loading your screens “on demand” whenever they are to be used, or even load them for just certain regions of your main screen (like a tab). To load a screen with FXML and then assign it to your main stage you would do something like:

    Parent root = FXMLLoader.load(me.getClass().getResource("Scene2.fxml"));
    Scene scene = new Scene( root );
    stage.setScene(scene);
    

    Another alternative is to use multiple stages, launch a stage whenever you need to do a specific action. This stage can be modal, so when it is closed, the main window stays behind:

    final  Stage stage = new Stage();     
    stage.initStyle(StageStyle.UNDECORATED);
    stage.initOwner(owner_stage);
    stage.initModality(Modality.APPLICATION_MODAL);
    

    In this later case, the “quit mechanism” is just hiding the scene:

    // from a label of your controller class
    label.getScene().getWindow().hide();  
    

    In the first case, you would just load the main scene in your stage. Using multiple stages is the most common and straightforward way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I want to do some test app that uses sound recording, but it
i made a small test app with 2 screens. the first screen contains an
I'm want to make a test app to record some sound and then modify
I want to write a simple P2P test app which uses HTTP as underlying
In my test app, which uses test::unit, I need to start by pulling a
In my test app, I want to style variable height table cells with a
This is some sample test app i trying to learn Parallel.Foreach Loop functionality static
I've got a simple winform test app i'm using to try some Log4Net Dependency
I placed this control in a test app, and it works fine. But in
I am working on a little test app to scrape some data (in this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.