0

I have this JavaFx app when I press one of the buttons, an other javafx class lauch!

enter image description here

enter image description here so all what i need to know is : when I press the back button of the seconde class I need to find the first window with the same values entred in the bigging ! here what I can do for now:

Platform.runLater(new Runnable() {
    @Override
    public void run() {
        try {
            new MainApp().start(stage);
        } catch (Exception e) {
            StringWriter errors = new StringWriter();
            e.printStackTrace(new PrintWriter(errors));
            log.error(errors.toString());
        }
    }    
});
Miss Chanandler Bong
  • 4,081
  • 10
  • 26
  • 36
MAryem
  • 182
  • 1
  • 2
  • 14

1 Answers1

0

I had the same problem and here is the solution: let's suppose you have those 2 TextField one of them called apiurl and other called mainUrl ! all what you have to do is to to create String url = ""; and go to your button action and add this line : url=apiurl.getText(); in the initialize method in your controller add this : apiurl.setText(url); and this worked well for me !

maryem neyli
  • 467
  • 3
  • 20
  • @kleopatra no I tried this solution that you propose and it did not work – maryem neyli May 25 '20 at 08:45
  • then you did something wrong - passing parameters around (with one of the various options mentioned in the referenced answer) does work _always_ As an aside: you seem to have a very effective crystal ball - this answer has no relation to the question and still is accepted ;) Aside: in case you are the same person as the OP with two accounts: the moment you start upvoting between those accounts you are violating the rules of the site and might get in trouble, just saying .. – kleopatra May 25 '20 at 09:09
  • @kleopatra in my case since my variable is needed to be used in other class I put it static but in her case truly she can delete the "static" key word! I updated the response – maryem neyli May 25 '20 at 10:15
  • just stating the obvious - there is __no__ relation between the question and this answer ;) If you consider facts as rude I can't help it *shrugs – kleopatra May 25 '20 at 10:21