Hello I have read an example that I found on my school database about MVC in Java. there is this example where the buttons go into the Controller part. but isn’t it correct that the buttons need to be in the VIEW because everything that the user can see must be in the view or am I understanding it wrong and is it different in Java?
Share
This image is a generalization of MVC from the Model-View-Controller page on Wikipedia:
In general, if you’re dealing with drawing/rendering UI elements, that belongs in the view. Actions/events that let the user interact with the button would belong in the controller (and may have functionality delegated to services as necessary).
You don’t want to put any code that draws/renders buttons in the controller – that tightly couples the controller to a specific view, which goes against the principle of using this design pattern.