1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
- package bandit.controller;
-
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import bandit.model.WuerfelModel;
- import bandit.view.WuerfelView;
-
- /**
- *
- * @author chris
- */
- public class BanditController implements ActionListener
- {
- private WuerfelView view;
- private WuerfelModel model;
-
- public BanditController(WuerfelView view, WuerfelModel model)
- {
- this.view = view;
- this.model = model;
-
- }
- public void registerEvents()
- {
- view.getBtnStart().addActionListener(this);
- view.getBtnStop().addActionListener(this);
- }
- public void registerCommands()
- {
- // CommandOpen cmdOpen = new CommandOpen(view, model);
- // invoker.addCommand(view.getMnuOpen(), cmdOpen);
- // invoker.addCommand(view.getBtnOpen(), cmdOpen);
- // //usw.
- //
- //
- // CommandSave cmdSave = new CommandSave(view, model);
- // invoker.addCommand(view.getMnuSave(), cmdSave);
- // invoker.addCommand(view.getBtnSave(), cmdSave);
- }
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- if (e.getSource() == view.getBtnStart())
- {
- model.start();
- }
- else
- {
- model.stop();
- }
- }
- }
|