Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

observer pattern java

class JPanelSignal extends JPanel implements Observer {

  void init(Signal lSigAObserver) {
    lSigAObserver.addObserver(this); // (2) ajout d'observateur
  }

  void update(Observable observable, Object objectConcerne) {
    repaint();  // (3) traitement de l'observation
  }
}
Source by fr.wikipedia.org #
 
PREVIOUS NEXT
Tagged: #observer #pattern #java
ADD COMMENT
Topic
Name
1+7 =