ok p.s. I did not notice that this was an assignment, and that you had to use imageicons. I have no idea how I would implement 100 imageicons on a single panel. Maybe a GridLayout manager? ANother possibility is to have the mouseListener on the underlying panel of JFRame rather than a mouseListener for each square. e.getX and e.getY could be used to determine which square is being clicked on.
ANyways, I'm not an expert or anything, this chess program was basically a learning project that has undergone a couple of rewrites. my current solution is based on the following, which in retrospect probably doesn't fit well with your requirements.
1. instead of using ImageIcons for the pieces, I use a combination of graphics commands such as fillArc, fillOval, etc. This makes the idea of using just a single JPanel for the entire board easier to implement.
2. Any time the position changes, the entire board is repainted. I'm not sure this is necessary, but it is simpler to implement. Intuitively and esthetically I'm not thrilled about redrawing the entire board for each move, but it works fine and does not seem to cause any resource issues.
Anyways, first time around I had the same idea as you, ImageIcons and JLabels and separate JPanels for each square, but I was not thrilled with the idea of 64 JPanels. That's just me, I can't really say that my idea is better or worse than yours, I'm sure you can make yours work ok. Does that answer your question?
My program is available online at the link in my signature. You will find there a technical overview of the design that you may benefit from.
Anyways, I enjoy this kind of stuff, so we can discuss more if you like. Do you intend to program your own draughts "engine" to play against? That will be a challenge. A proper engine would use some sort of recursive algorithm to think ahead, and I find that sort of stuff very difficult to wrap my head around.
p.s. if you edit your post to reduce the indents in your code, that should eliminate the need to scroll horizontally to read the posts in the
thread.
p.s.s. here is my paint method, which should give you an idea of how the board is set up.