How does one most efficiently connect a view and a controller in a MVC-esque Java application. Currently, I'm doing the following:
Controller creates view and passes itself into the view as a parameter:
MyView view = new MyView(this);
View has
ActionListeners for buttons.ActionListenerdoesn't do much but fire an action in the controller:private class ButtonAListener implements ActionListener { @Override public void actionPerformed(ActionEvent arg0) { controller.clickedButtonA(); } }
It is working OK, but is this acceptable? For example, if a button is clicked in the view, the ActionListener passes that information into the controller, which does some calculations, and passes back a command to update the view.