title: How to signal the event that two shapes have touched? Java
body: <p>So I have a Blob shape, which implements MoveableShape.</p>
  
  <pre><code>public interface MoveableShape
  {
     void draw(Graphics2D g2);
     void translate(int dx, int dy);
  }
  </code></pre>
  
  <p>Let's say an instance of a Blob, b1, hits another Blob, b2. Once it hits the other blob, I want it to reverse its direction. How would I signal this in java? Up until now, this is what I've been doing to move it normally:</p>
  
  <pre><code>Timer t = new Timer(DELAY, new
       ActionListener()
       {
          public void actionPerformed(ActionEvent event)
          {
             b1.translate(1, 0);
             label.repaint();
          }
       });
    t.start();
  </code></pre>
  
  <p>And I sincerely believe there is a more efficient way to do this rather than replacing those 6th and 7th lines with this:</p>
  
  <pre><code>b1.translate(speed, 0);
  label.repaint();
  if(b1.getX()==b2.getX()) { speed = -speed }
  </code></pre>
  
  <p>I apologize for not documenting every detail, but you should get the general gist from that.  Is it possible to add some sort of custom event to b1 to reverse its direction, or something like that? Moreover, is it possible to do this with an ActionListener? Thanks.</p>