Hi, I am trying to make a tile puzzle game. I am having trouble in getting the tiles (JPanels) to move.
I have a Puzzle class that extends JPanel, and this contains either a 3*3 or a 4*4 grid of tiles, which are instances of my PuzzlePanel class, which also extends JPanel, these PuzzlePanels have parts of an overall image drawn on them...so that correctly arranged, they show the image. The instance of the Puzzle class is also contained in another JPanel.
PuzzlePanel implements MouseListener, on mouseEntered() a PuzzlePanel, it is highlighted with a rectangle around it, and unhighlighted on mouseExit().
Is there a way that I can inform the Puzzle class that one of the instances of PuzzlePanel has been clicked, through using mouseClicked() in PuzzlePanel?