Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to correctly communicate between two different MVC Controllers in Java Swing?
    text
    copied!<p>Can you explain me how a Controller can call another Controller method in a simple but still correct way?</p> <p>Please provide some code!</p> <p>background: I Have 2 different Controllers-View-Model and 2 libraries and they need to communicate between each other:</p> <ol> <li><p>SettingsWindow/SettingsController/SettingsModel: Responsible for the app settings. The model is a singleton because I need the settings data all over the app;</p></li> <li><p>A Library for Monitoring a directory which creates an event every time a file is created in a specific directory. The monitored dir path is defined in the SettingsModel; I'm using the Java 7 WatchService API for that;</p></li> <li><p>A Library for Monitoring a webserver and download new files. The webserver address and the save directory are both defined in the SettingsModel; I'm using HttpsUrlConnection and a timer for that;</p></li> <li><p>MainWindow/MainController/MainModel: Responsible for the main app window, which has a table that must be updated every time a new file is created in the monitored directory, and also everytime a file is downloaded by the above libraries.</p></li> </ol> <p>So how do I correctly Instantiate and communicate those 4 different features?<br> How do their Controllers commnuicate between them, since they are all related? How should I organize this project in terms of MVC?</p> <p>PLEASE provide the basic MVC scaffold (skeleton) and show where I create the instances, where and how I call each others method. I'm new to Java, specially swing and mvc. I've read a lot, but I got stuck in this situation.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload