0

i have a main view with a combo box and its controller, and a second view which gets loaded when a button is clicked on the main view. the second view contains a button and a label and has its different controller. what i want to do is, when the button on the second controller is clicked, the selected item on the combo box on the main view should be displayed on the label..

so that when i go back and change the item on the combo box and go back and click the button on the second view ,the text on the label would be changed to the currently selected item.

any help..??? thanks

  • Pass the reference of the first controller to the 2nd controller. – Jai Dec 10 '18 at 09:11
  • what i did was, i created an object of the first controller in the second controller like this... firstController controllerOne = new firstController(); then i was able to get access to all the public variables and methods in the firstController using the controllerOne object... however im geting Null pointer exception... – nyelnizy Dec 10 '18 at 09:46
  • 1
    Possible duplicate of [Passing Parameters JavaFX FXML](https://stackoverflow.com/questions/14187963/passing-parameters-javafx-fxml) – kleopatra Dec 10 '18 at 10:54

0 Answers0