I have a probably minor application design (and maybe understanding) problem. Please forgive me if the following problem is quite noob-like. I just started learning Java three weeks ago and didn't find a proper answer to my problem.
Situation: I am trying to bring an old pub game into a digitized version with Java and JavaFX for the UI. I am using an MVC design, whereas I use the controller to initiate the start of the game by a user click. Then the controllers do all the prep-actions for the game. One important part is creating n (number of players) objects from a class Player and writing them into a HashMap. And here probably starts the design issue: The Map and its referred objects hold all the core game information of the players. Thus I almost always hand over the Map between the methods from the controller and the model so that I can always reuse the info in the Map. Now I am at the point, where the initial program/game board set-up is done and the game needs to wait for a user input where the user presses a button.
Tried/Idea: I initially thought that I could put any method as OnAction on the button and then continue from there. But since all my methods require the Map as an input parameter I cannot put the method as OnAction for the button (in SceneBuilder).
Problem: Actually the problem is (as far as I see it), that I don't have the Map (which is my central data storage an which is updated by the various methods and shall be updated by the user actions) centrally and "method independent". So since I want to call a method from a user click, and thus the method is independent of any "program flow", how to get access here to my Map to update the data accordingly and reuse the Map in the subsequent program.
As said I think there is a super easy solution for this problem and probably I don't get one of the basic concepts in detail but I hope I could explain my issue in an understandable way.