You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ReceiveAdapter.java 783B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package controller;
  7. import java.util.Observable;
  8. import java.util.Observer;
  9. import model.Transmitter;
  10. import view.ChatView;
  11. /**
  12. *
  13. * @author Apollo
  14. */
  15. public class ReceiveAdapter implements Observer
  16. {
  17. ChatView view;
  18. Transmitter model;
  19. public ReceiveAdapter(ChatView view,Transmitter model)
  20. {
  21. this.view = view;
  22. this.model = model;
  23. }
  24. public void registerEvents()
  25. {
  26. model.addObserver(this);
  27. }
  28. @Override
  29. public void update(Observable arg0, Object arg1)
  30. {
  31. String message = model.getNachricht();
  32. view.getChatanzeige().append(message+"\n");
  33. }
  34. }