I have an 2d array of JButton as a grid for a battleship game.
Each Jbutton on the grid is registered with MouseListener.
I want to set each button, whenever player click on it,the MouseEvent will do something on it.(fill the button with color or something)
My question is, how do I let the program knows when player click on that particular button. Hope someone here can help me, I need to find this urgently. Thank you in advance.
Using MouseEvent with array of JButtonriel December 19, 2011 at 7:08 AM
I have an 2d array of JButton as a grid for a battleship game. Each Jbutton on the grid is registered with MouseListener. I want to set each button, whenever player click on it,the MouseEvent will do something on it.(fill the button with color or something) My question is, how do I let the program knows when player click on that particular button. Hope someone here can help me, I need to find this urgently. Thank you in advance.
Post your Comment