addMouseListener to my own class

Hi all,

Is it possible to add a MouseListener to myown class?

for example, i have a class called SpaceShip. This implements MouseListener and extends my Sprite class.

When i click on the space ship, I want to show the GUI or do some action.

public class SpaceShip extends Sprite impliments MouseListener
{
    // constructor stuff
 
    public void mouseClicked(MouseEvent e) 
    {
          //  do whatever i want it to do
    }
}

how can i add a mouse listener to this class?
As far as i can tell, the class needs to extend jFrame for this to work, right?

Thanks,
Matt

ok, I think I have solved this by adding a ‘addMouseHandeler’ public class to my Game class that can be accessed by everything.

This does seem a little bit of a crappy way of dioing it thouth :stuck_out_tongue:

Thanks anyway