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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -