Skip to content

Commit

Permalink
Feat: LoaderScene class has better ish dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBalunan committed Mar 13, 2026
1 parent 255e786 commit bf10829
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ public static void LoadScene(String sceneName, ActionEvent event, Charity charit
Parent root = fxmlLoader.load();

System.out.println("Controller: " + fxmlLoader.getController());
DonationPageController controller = fxmlLoader.getController();
controller.setCharity(charity);
Object controller = fxmlLoader.getController();

if (controller instanceof CharityPageController charityController) {
charityController.setCharity(charity);
}
if (controller instanceof DonationPageController donationController) {
donationController.setCharity(charity);
}

Stage stage = (Stage) ((Node)event.getSource()).getScene().getWindow();
Scene scene = new Scene(root);
Expand Down

0 comments on commit bf10829

Please sign in to comment.