
-----------------------------------
Regeane
Sun May 28, 2006 8:25 am

Question regarding arrays of JButton and ActionListeners...
-----------------------------------
I'm creating a BINGO program, and it has a 25X25 grid of buttons. I have it set up as a 3D array of JButton, and I have each button respond when it's clicked, but I need some way to register which button has been clicked, and I was wondering if there's a better way to do it than lots and lots of if statements...

This is the code I have for drawing the cards:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class BingoDrawer{
	JFrame[] frame;
	JPanel[] pane;
	JButton[][] button;
	int x,y,z;
	public BingoDrawer(int num_players, BingoGame bg){
		frame = new JFrame[num_players];
		pane = new JPanel[num_players];
		button = new JButton[num_players][25];
		for(x=0;x