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.

BanditController.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 bandit.controller;
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9. import bandit.model.WuerfelModel;
  10. import bandit.view.WuerfelView;
  11. /**
  12. *
  13. * @author chris
  14. */
  15. public class BanditController implements ActionListener
  16. {
  17. private WuerfelView view;
  18. private WuerfelModel model;
  19. public BanditController(WuerfelView view, WuerfelModel model)
  20. {
  21. this.view = view;
  22. this.model = model;
  23. }
  24. public void registerEvents()
  25. {
  26. view.getBtnStart().addActionListener(this);
  27. view.getBtnStop().addActionListener(this);
  28. }
  29. public void registerCommands()
  30. {
  31. // CommandOpen cmdOpen = new CommandOpen(view, model);
  32. // invoker.addCommand(view.getMnuOpen(), cmdOpen);
  33. // invoker.addCommand(view.getBtnOpen(), cmdOpen);
  34. // //usw.
  35. //
  36. //
  37. // CommandSave cmdSave = new CommandSave(view, model);
  38. // invoker.addCommand(view.getMnuSave(), cmdSave);
  39. // invoker.addCommand(view.getBtnSave(), cmdSave);
  40. }
  41. @Override
  42. public void actionPerformed(ActionEvent e)
  43. {
  44. if (e.getSource() == view.getBtnStart())
  45. {
  46. model.start();
  47. }
  48. else
  49. {
  50. model.stop();
  51. }
  52. }
  53. }