public void mainLoop() {
    while (true) {
      // användaren klickar på en figur
      // användaren klickar på en ny position
      // figuren flyttas till den nya positionen
      w.waitForMouseClick();
      int m_x = w.getMouseX();
      int m_y = w.getMouseY();

      Shape s = shapes.findHit(m_x, m_y);
      if (s != null) {
        w.waitForMouseClick();
        m_x = w.getMouseX();
        m_y = w.getMouseY();
        s.moveToAndDraw(w, m_x, m_y);
      }
    }
  }
 public void mainLoop() {
   while (true) {
     w.waitForMouseClick();
     int x = w.getMouseX();
     int y = w.getMouseY();
     Shape s = shapes.findHit(x, y);
     if (s != null) {
       w.waitForMouseClick();
       x = w.getMouseX();
       y = w.getMouseY();
       s.moveToAndDraw(w, x, y);
       shapes.draw(w);
       shapes.print();
     } else {
       System.out.println("Klicka på en figur, din pajas!");
     }
   }
 }