/* * This program illustrates how to find which button among many is pressed. * * */ import javax.swing.*; import java.awt.event.*; import java.awt.*; public class ManyButtons implements ActionListener{ private int buttonCount=12; JButton [] buttons=new JButton[buttonCount]; // Button array JButton exit=new JButton("Exit"); // To exit from this app. private void createButtons(){ // Create buttons and add an actionListener to each. Label does not matter other than for aesthetics. for (int i=0; i