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 781B

1234567891011121314151617181920212223242526272829303132333435
  1. package chatprogramm.controller;
  2. import chatprogramm.model.Transmitter;
  3. import chatprogramm.view.ChatView;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6. /**
  7. *
  8. * @author Marian
  9. */
  10. public class SendController implements ActionListener
  11. {
  12. private Transmitter model;
  13. private ChatView view;
  14. public SendController(Transmitter m, ChatView v)
  15. {
  16. this.model = m;
  17. this.view = v;
  18. }
  19. public void registerEvents()
  20. {
  21. this.view.getBtSend().addActionListener(this);
  22. this.view.getTfMessage().addActionListener(this);
  23. }
  24. @Override
  25. public void actionPerformed(ActionEvent ae)
  26. {
  27. model.sendMessage(view.getTfMessage().getText());
  28. view.getTfMessage().setText("");
  29. }
  30. }