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.

CommandController.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 gui.Hauptfenster;
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10. import java.text.ParseException;
  11. import java.util.logging.Level;
  12. import java.util.logging.Logger;
  13. import javax.sip.InvalidArgumentException;
  14. import javax.sip.SipException;
  15. import model.VoIP;
  16. /**
  17. *
  18. * @author Normal
  19. */
  20. public class CommandController implements ActionListener
  21. {
  22. private VoIP model;
  23. private Hauptfenster view;
  24. public CommandController(VoIP model, Hauptfenster view)
  25. {
  26. this.model = model;
  27. this.view = view;
  28. }
  29. public void registerEvents()
  30. {
  31. view.getBtn1().addActionListener(this);
  32. }
  33. @Override
  34. public void actionPerformed(ActionEvent e)
  35. {
  36. try
  37. {
  38. model.sendRegister("123123", 1);
  39. }
  40. catch (ParseException ex)
  41. {
  42. Logger.getLogger(CommandController.class.getName()).log(Level.SEVERE, null, ex);
  43. }
  44. catch (InvalidArgumentException ex)
  45. {
  46. Logger.getLogger(CommandController.class.getName()).log(Level.SEVERE, null, ex);
  47. }
  48. catch (SipException ex)
  49. {
  50. Logger.getLogger(CommandController.class.getName()).log(Level.SEVERE, null, ex);
  51. }
  52. }
  53. }