I have got a program having an array of buttons, each of these button has their mouselistener event.
Now, how can i find which of the buton is clicked through the mouse listener.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The usual way to respond to buttons is via an
ActionListener, as discussed in How to Use Buttons. This example uses both individual and common listeners to implement a keypad. If you are actually using aMouseListenerto locate components,findComponentAt(int x, int y)may be useful, as shown here.