52 lines
1.1 KiB
Java
52 lines
1.1 KiB
Java
/*
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
*/
|
|
|
|
package bandit.Schnittstelle;
|
|
|
|
import bandit.Model.Zahlengenerator;
|
|
import bandit.View.ZahlenView;
|
|
import java.awt.event.ActionEvent;
|
|
import java.awt.event.ActionListener;
|
|
import java.util.logging.Logger;
|
|
import bandit.util.OhmLogger;
|
|
|
|
/**
|
|
*
|
|
* @author le
|
|
*/
|
|
public class StartStopController implements ActionListener
|
|
{
|
|
private static Logger lg = OhmLogger.getLogger();
|
|
private ZahlenView view;
|
|
private Zahlengenerator model;
|
|
|
|
public StartStopController(ZahlenView view, Zahlengenerator model)
|
|
{
|
|
this.view = view;
|
|
this.model = model;
|
|
}
|
|
|
|
public void registerEvents()
|
|
{
|
|
view.getBtnStart().addActionListener(this);
|
|
view.getBtnStop().addActionListener(this);
|
|
}
|
|
|
|
@Override
|
|
public void actionPerformed(ActionEvent evt)
|
|
{
|
|
if (evt.getSource() == view.getBtnStart())
|
|
{
|
|
lg.info("Start gedruekt");
|
|
model.start();
|
|
}
|
|
else
|
|
{
|
|
lg.info("Stop gedrueckt");
|
|
model.stop();
|
|
}
|
|
}
|
|
}
|