2

My View-Controller

public class MainForm implements java.util.Observer{
@Override
    public void update(Observable o, Object arg) {
        System.err.println("update View ....");
        this.textField_15.setText(String.valueOf(model.getThermalConductivity()));
            /*
*****
*/


    }
}

In the model I use methods

setChanged();
notifyObservers();

All events model updates are processed in the method "update"

How to divide the controller?

BILL
  • 4,711
  • 10
  • 57
  • 96
  • The MainForm looks like your view to me as it has text fields and other GUI thingies. Maybe I'm wrong, but I think of the GUI listeners as more of the control aspect. – Hovercraft Full Of Eels May 30 '11 at 17:43
  • First off, avoid using java.util.Observer, this is probably the worst implementation of the observer pattern. – jfpoilpret May 30 '11 at 20:28
  • @jfpoilpret: [`java.util.Observable`](http://download.oracle.com/javase/6/docs/api/java/util/Observable.html) has the advantage of being simple and understandable, but your point is otherwise well-taken. – trashgod May 30 '11 at 23:13

1 Answers1

2

You might enjoy trying this example. For simplicity, the model extends Observable, but several other approaches are mentioned with links to examples.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045