|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /*
- * 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 wuerfel.controller;
-
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import wuerfel.model.WuerfelModel;
- import wuerfel.view.WuerfelView;
-
- /**
- *
- * @author leo
- */
- public class StartStopController implements ActionListener
- {
- private WuerfelView view;
- private WuerfelModel model;
-
- public StartStopController(WuerfelView view, WuerfelModel model)
- {
- this.view = view;
- this.model = model;
- }
-
- public void registerEvents()
- {
- view.getBtnStart().addActionListener(this);
- view.getBtnStop().addActionListener(this);
- }
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- if (e.getSource() == view.getBtnStart())
- {
- model.start();
- }
- else
- {
- model.stop();
- }
- }
- }
|