package cse1030; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class SimpleController implements ActionListener { public static final String ROLL = "ROLL"; private SimpleModel model; private SimpleView view; public SimpleController() { } public void setModel(SimpleModel model) { this.model = model; } public void setView(SimpleView view) { this.view = view; } @Override public void actionPerformed(ActionEvent event) { String action = event.getActionCommand(); if (action.equals(ROLL)) { // ask the model to roll the die and get the value this.model.roll(); String value = this.model.getValue(); // ask the view to update the label with the new roll this.view.setRoll(value); } } }