title: Using Observer pattern to move labels (JavaFx)
body: <p>I am creating a chat program where my chat persons are a label. the labels can be moved around on the screen when the user clicks on the <code>anchorpane</code> now there are two senerios here:</p>
  
  <ol>
  <li><p>The chatperson has to locally move.</p></li>
  <li><p>the client has to send this movement to all the other connected clients.</p></li>
  </ol>
  
  <p>The 2nd case is easy enough if the objects works as they should currently my <code>ChatPerson</code> object looks like this:</p>
  
  <pre><code> package GUI;
  
  
  public class ChatPerson {
  
      private String username;
      private int x;
      private int y;
      // Brugerens ID i databasen
      private int id;
  
      public ChatPerson(String name){
          this.username = name;
      }
  
      public String getUserName(){
          return username;
      }
      public void setX(int x){
          this.x = x;
      }
      public void setY(int y){
          this.y = y;
      }
      public int getX(){
          return x;
      }
      public int getY(){
          return y;
      }
      public int getId(){
          return id;
      }
      public void setId(int id){
          this.id = id;
      }
  
  
  
  }
  </code></pre>
  
  <p>My question is how would i implement this sort of behavior. ive looked up the Observer pattern but i am finding it hard on how to put it to work in this case?</p>
  
  <p>Also, do JavaFx have some sort of implementation that i could use here? Ive looked at Observablelist but i cant really get my mind through how that would help me?</p>