Say suppose i created a Button array now when i click upon it the control goes to actionPerformed(ActionEvent e) method. Now i know that you get the source as well the string related to the button via getSource() and getActionCommand() respectively. But can i get the index of the button like which button was clicked? Thanks in advance!
posted 6 years ago
You'll need to iterate through the array and compare the event source to the button references you've stored in it.
Or you can make the index part of the command string, and extract it using string operations.