title: Wrong Mouselistener fires
body: <p>I made a program in Java in which you can draw Ellipses and Rectangles, then later group them to do Resizes and Move actions on them. </p>
  
  <p>I add <code>MouseListener</code>s to both the <code>DrawPanel(JPanel)</code> as all the created Shapes(Components on that drawPanel). But after I group several shapes together, it seems like the <code>MouseListener</code> is pushed backwards and the <code>MouseListener</code> linked to <code>MainFrame</code> fires. </p>
  
  <p>I have made a workaround the calls .GetCompontent() function  on the <code>JPanel</code>. But is must surely be possible to push forward a Components <code>MouseListener</code>?</p>
  
  <p>Both the <code>JPanel</code> and the Components on it use the same <code>MouseListener</code></p>
  
  <pre><code>public class MainFrame extends JFrame implements ActionListener,MouseInputListener {        
  
  public MainFrame() {
      super("Tekenprogramma");
      //some other stuf
      drawPanel.addMouseListener(this);
      drawPanel.addMouseMotionListener(this);
  }
  </code></pre>
  
  <p>and when shapes are created and added in the same class:</p>
  
  <pre><code>public void mousePressed(MouseEvent e) {
      if(e.getSource() == drawPanel) {
          Point pos = e.getPoint();
          switch(mode) {
  //Some other cases...
          case RECTANGLE:
              shape = new Rectangle(pos);
              shape.addMouseListener(this);
              shape.addMouseMotionListener(this);
              storeAndExecute(new RectangleCommand(drawPanel,shape));
  </code></pre>
  
  <p>initially, the shapes do react to their own listener. But after I remove and read them (nested in a component without <code>MouseListener</code> (group)) They stop firing and the <code>drawPanel</code>'s <code>MouseListener</code> takes over.</p>