Created
March 13, 2012 05:24
-
-
Save jimmykurian/2026977 to your computer and use it in GitHub Desktop.
A Java program that has two buttons, each of which prints a message “I was clicked n time!” whenever the button is clicked. Each button has a separate click count.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ClickListener.java - Jimmy Kurian | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class ClickListener implements ActionListener | |
{ | |
private int numClicks = 0; | |
public void actionPerformed(ActionEvent event) | |
{ | |
numClicks++; | |
System.out.println("I was clicked " + numClicks + " times."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment