Advertisement
aidandeno

Checkers - MyListener

Sep 8th, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. /**
  2. * Listener Class for Checkers Game
  3. *
  4. * @author
  5. * Date:
  6. */
  7.  
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10. import javax.swing.JLabel;
  11.  
  12. public class MyListener implements ActionListener{
  13.  
  14.     private int count = 0;
  15.     private JLabel label;
  16.  
  17.     public MyListener(JLabel label){
  18.         this.label = label;
  19.     }
  20.  
  21.     public void actionPerformed(ActionEvent e) {
  22.  
  23.         count++;
  24.  
  25.         label.setText("Count: " + count);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement