Which of the following represents the controller logic for a Swing application based on MVC?
class Controller {
private Model model;
private View view;
private ActionListener actionListener;
public Controller(Model model, View view) {
this.model = model;
this.view = view;
}
public void control() {
actionListener = actionEvent -> {
model.increment();
view.setText(Integer.toString(model.getNumber()));
};
view.getButton().addActionListener(actionListener);
}
}