Detect which button was clicked in a 2D array Java -
in our code have 10 10 button array. made 10 10 array using nested loop, , have no issue creating buttons. also, have when button clicked displays "button clicked". how can identify which button clicked?
we're using actionlisteners , actionperformed methods.
you can call getsource() method on event.
or can use action classes in buttons , create new instance of each when build buttons.
Comments
Post a Comment