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 9144633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:19:01+00:00 2026-06-17T10:19:01+00:00

I have two stages Stage1 with Scene1 and own Controller1 and Stage2 with another

  • 0

I have two stages

Stage1 with Scene1 and own Controller1
and
Stage2 with another Scene2 and Controller2

From Stage1 i call Stage2 with ShowAndWait.
And set for Stage2 listener for Hiding stage.

From Stage2.Controller2 a call hide and breakpointed in

setOnHiding(new EventHandler<WindowEvent>() {
            @Override
            public void handle(WindowEvent t) {
                System.out.print(t.getSource());
            }
        });

How i can passing paramers between this stages in cases:
1. stage1 pass to stage2
2. stage2 result some data params to stage1

?

  • 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-17T10:19:03+00:00Added an answer on June 17, 2026 at 10:19 am

    This is my solution:
    I have 2 class MyStage and MyController
    Stage1, Stage2 should extend MyStage
    Controller1, Controller2 should extend MyController

    Stage2 s2 = new MyStage(data);
    s2.show();
    result = s2.getResult();
    
    class Stage2 extends Stage{
        private FXMLLoader fxmlLoader;
        private Object data;
        private Object result;
    
        public Stage(Object data){
            this.data = data;
            ...//do something with data
            getController().initWithData(data);
        }
    
        Object getResult(){
            return getController().getResult();
        }
    
        public MyController getController() {
            return (MyController) fxmlLoader.getController();
        }
    }
    
    Class MyController{
        public void initWithData(Object data){
        ...//
        }
    
        public Object getResult(){
        ...//
        return result;
        }
    
        public void setStage(Stage stage) {
                this.stage = stage;
    }
    
        @FXML
        protected void close() {
                getStage().close();
        }
    
    }
    

    it’s general but there are some minor changes to the code when using fxml vs non-fxml.
    You can pass stage references to controller to close the stage from another controller.
    I am too sleepy now, hope there’s no error.
    I will update later

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

Sidebar

Related Questions

I have two classes (MVC view model) which inherits from one abstract base class.
I have an application that contains two stages which should be shown on two
I have two questions, but let me set the stage first: Say you have
I am on the stage of development where I have two modules and from
I have problem with conversion from String into two dimension int array. Let's say
I have my main stage, and I have two objects (blocks), these two objects
I have two queries that find both the Zip codes, and the States for
I have a question: I have two MSSQL tables, items and states, that are
As the question states, I have two ethernet devices I need to use. A
Have two folders with approx. 150 java property files. In a shell script, how

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.