Hello, I have been trying to access a Controller instance already loaded in another Class( Class A) using FXMLLoader.load(getClass().getResource("Afile.fxml")).
So when I was invoking the load method in Class B, I realized that method creates another instance of the Controller class of Afile.fxml. And I need to have access to the instance created in the Class A.
So my question is: How can I have access to the Controller instance already loaded in another class (Class A).
Thanks in advance for any help.
Here in code the question that I'm asking:
public class A{
public void initialize(URL url, ResourceBundle rb) {
final AnchorPane apBusquedaPadron = FXMLLoader.load(getClass().getResource("busquedaPadron.fxml"));
}
}
public class B{
public void initialize(URL url, ResourceBundle rb) {
final AnchorPane apBusquedaPadron = FXMLLoader.load(getClass().getResource("busquedaPadron.fxml"));
}
}