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.

SendController.java 946B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 kommunikation.controller;
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9. import kommunikation.transmitter.BilderKom;
  10. import kommunikation.view.ViewChat;
  11. /**
  12. *
  13. * @author Alexander_Christoph
  14. */
  15. public class SendController implements ActionListener
  16. {
  17. ViewChat view;
  18. BilderKom model;
  19. public SendController(ViewChat view, BilderKom model)
  20. {
  21. this.view = view;
  22. this.model = model;
  23. }
  24. public void registerEvents()
  25. {
  26. view.getTfMessage().addActionListener(this);
  27. }
  28. @Override
  29. public void actionPerformed(ActionEvent arg0)
  30. {
  31. String text = view.getTfMessage().getText();
  32. view.getTaChat().append("Ich: "+ text+"\n");
  33. model.senden(text);
  34. view.getTfMessage().setText("");
  35. }
  36. }