I am making a little simulator for some minor testing, just a little test thing for me that implements swing to run this little GUI. Right now I have my GUI and business logic tied together. I know that is not ideal so I am wondering how to efficiently decouple them.
I was doing this…
1. Main.java
2. SimulatorGUI.java
3. SimulatorLogic.java
I was using action events in the SimulatorGUI.java to invoke methods on my SimulatorLogic reference. However when certain things occur in my SimulatorLogic, lets say socket connection closed, I want to update the GUI status bar. What I did was make the SimulatorLogic extend the Simulator GUI and I would just call an inheritated update method() I know this sounds silly but thats all i thouht of at 12AM.
I guess what I am asking is, is there an efficient way, easy way for me to decouple these two where the SimulatorLogic can notify the GUI when needed.
Right now I have
Main.java
SimulatorGUI.java and an inner SimulatorLogic.java This way works but it seems like a poor way of coding this.
I was doing this…
1. Main.java
2. SimulatorGUI.java
3. SimulatorLogic.java
I was using action events in the SimulatorGUI.java to invoke methods on my SimulatorLogic reference. However when certain things occur in my SimulatorLogic, lets say socket connection closed, I want to update the GUI status bar. What I did was make the SimulatorLogic extend the Simulator GUI and I would just call an inheritated update method() I know this sounds silly but thats all i thouht of at 12AM.
I guess what I am asking is, is there an efficient way, easy way for me to decouple these two where the SimulatorLogic can notify the GUI when needed.
Right now I have
Main.java
SimulatorGUI.java and an inner SimulatorLogic.java This way works but it seems like a poor way of coding this.