This is the only way to do it:
an ActionEvent only contains the address of the JButton that is pressed. You'll have to search your buttonarray for a matching address.
public void actionPerformed(Actionevent e) {
if (e.getSource()==buttons[0][0]) // .....
if (e.getSource()==buttons[0][1]) // .....
if (e.getSource()==buttons[0][2]) // .....
if (e.getSource()==buttons[1][0]) // .....
// .......
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.