package class4_3_ActionHandlers; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class ButtonHandler implements ActionListener { private Gui gui; public ButtonHandler(Gui gui) { this.gui = gui; } /** * Make the label say "start" if I press start, * and "stop" if I press stop. * @param e the event that occurred */ public void actionPerformed(ActionEvent e) { System.out.println("Button pressed"); Object source = e.getSource(); if(source == gui.startButton) { gui.label.setText("I'm starting"); } else if(source == gui.stopButton) { gui.label.setText("Done"); } else { gui.label.setText("unknown command sent"); } System.out.println("Counting to : "+Long.MAX_VALUE); for(long i = 0; i