Hi guys,
Im trying to do battleships game. But I dont know, what is the best way to create interactive battlefield? I created JFrame and put inside two JPanels (my and opponents field).I wanted to put inside JButtons (JFrame had GridLayout), but I was told this isnt right solution. It should be done with MouseListener. So I created JPanel and added mouselistener. Now, when I click somewhere in the field, program writes coordinates of field. But how to do interaction? I mean if you click somewhere, how should program find out what "box" did user hit and how to change/add icon on that position?
Thanx for answers