|
ButtonListener |
|
1 // joi/10/joi/ButtonListener.java 2 // 3 // 4 // Copyright 2003 Bill Campbell and Ethan Bolker 5 6 import java.awt.event.*; 7 8 /** 9 * A simple listener for responding to button presses. 10 * It knows the Panel on which the button lives, and 11 * responds to button events by sending a changeMessage() 12 * to that Panel. 13 * 14 * @version 10.2 15 */ 16 17 public class ButtonListener implements ActionListener 18 { 19 private JOIPanel panel; // the Panel containing the Button 20 21 /** 22 * Construct the ButtonListener. 23 * 24 * @param panel the Panel on which this Button will act. 25 */ 26 27 public ButtonListener( JOIPanel panel ) 28 { 29 this.panel = panel; 30 } 31 32 /** 33 * Defines the ActionListener behavior that must be implemented. 34 * 35 * When a user pushes the Button that we're listening to, 36 * send a changeMessage() message to the Panel. 37 * 38 * @param e the "event" when the button is pressed. 39 */ 40 41 public void actionPerformed( ActionEvent e ) 42 { 43 panel.changeMessage(); 44 } 45 } 46
|
ButtonListener |
|