I have used the MVC pattern extensively in web applications in C# ASP.net and PHP CodeIgniter + Laravel, but now I have to implement it for a java Swing application and I'm a bit lost when it comes to actually dynamically adding elements (like a JPanel) to a View from an event. In any Web MVC framework, I would simply return a partial view and inject it in a div. More explanations:

I have a View that has only one thing: a button that the MainController listens on. When I click the button, the view tells the controller to call the method "buttonClicked()". The result of that should be that a JPanel is created and added to the view, but how do I do that in Java Swing MVC? Like I said, in a web MVC framework, I would probably do something like "return new partialView(model)".

Since the only classes that should be dependent on the Swing framework are the Views, I understand that the JPanel is created in there, but isn't the controller (or the model) supposed to tell the view where to place it? How does that work?

Thanks. I hope by thoughts were clear enough, I'm just starting with java.