public void paint(Graphics g) {
   oval1back.paint(g);
   oval1a.paint(g);
   oval1b.paint(g);
   oval2.paint(g);
   g.setColor(new Color(0, 200, 0));
   drawDots(g, dotsA, dotANames_showalways, dotANames);
   g.setColor(new Color(0, 200, 0));
   drawDots(g, dotsB, dotBNames_showalways, dotBNames);
   g.setColor(Color.BLACK);
   drawConnections(g, connections);
 }
  public String getResultMsg() {
    List<Point> dotsAcopy = new LinkedList<Point>(dotsA);
    List<Point> dotsB1 = new LinkedList<Point>();
    List<Point> dotsB2 = new LinkedList<Point>();
    boolean correct = false;
    for (Connection con : connections) {
      dotsAcopy.remove(getPointIndex(dotsAcopy, con.src));

      if (!correct) {
        boolean inDotsB1 = getPointIndex(dotsB1, con.dst) >= 0;
        boolean inDotsB2 = getPointIndex(dotsB2, con.dst) >= 0;
        if (oval1a.isInside(con.src)) {
          if (inDotsB2) correct = true;
          else dotsB1.add(con.dst);
        } else { // in oval1b
          if (inDotsB1) correct = true;
          else dotsB2.add(con.dst);
        }
      }
    }

    if (!dotsAcopy.isEmpty()) return "alle Punkte in X müssen zugewiesen werden";
    else if (correct) return "das ist korrekt!";
    else return "leider ist das nicht korrekt";
  }
  public boolean isCorrect() {
    List<Point> dotsAcopy = new LinkedList<Point>(dotsA);
    List<Point> dotsB1 = new LinkedList<Point>();
    List<Point> dotsB2 = new LinkedList<Point>();
    boolean correct = false;
    for (Connection con : connections) {
      dotsAcopy.remove(getPointIndex(dotsAcopy, con.src));

      if (!correct) {
        boolean inDotsB1 = getPointIndex(dotsB1, con.dst) >= 0;
        boolean inDotsB2 = getPointIndex(dotsB2, con.dst) >= 0;
        if (oval1a.isInside(con.src)) {
          if (inDotsB2) correct = true;
          else dotsB1.add(con.dst);
        } else { // in oval1b
          if (inDotsB1) correct = true;
          else dotsB2.add(con.dst);
        }
      }
    }

    return dotsAcopy.isEmpty() && correct;
  }
  public void getSmallBox(int x, int y, int w, int h) {
    // create 9 small boxes

    cross = new Rectangle(x, y, w, h);
    cross.setBackground(Color.blue);

    circle = new Oval(x, y, w, h);
    circle.setBackground(Color.red);

    smallBox0 = new Rectangle(x, y, w / 3, h / 3);
    smallBox0.setBackground(Color.white);
    container.add(smallBox0);
    smallBox0.add(cross);
    cross.setVisible(setVisibility());
    smallBox0.add(circle);
    circle.setVisible(setVisibility());

    smallBox1 = new Rectangle(x + (w / 3), y, w / 3, h / 3);
    smallBox1.setBackground(Color.white);
    container.add(smallBox1);
    smallBox1.add(cross);
    cross.setVisible(setVisibility());
    smallBox1.add(circle);
    circle.setVisible(setVisibility());

    smallBox2 = new Rectangle(x + (2 * w / 3), y, w / 3, h / 3);
    smallBox2.setBackground(Color.white);
    container.add(smallBox2);
    smallBox2.add(cross);
    cross.setVisible(setVisibility());
    smallBox2.add(circle);
    circle.setVisible(setVisibility());

    smallBox3 = new Rectangle(x, y + (h / 3), w / 3, h / 3);
    smallBox3.setBackground(Color.white);
    container.add(smallBox3);
    smallBox3.add(cross);
    cross.setVisible(setVisibility());
    smallBox3.add(circle);
    circle.setVisible(setVisibility());

    smallBox4 = new Rectangle(x + (w / 3), y + (h / 3), w / 3, h / 3);
    smallBox4.setBackground(Color.white);
    container.add(smallBox4);
    smallBox4.add(cross);
    cross.setVisible(setVisibility());
    smallBox4.add(circle);
    circle.setVisible(setVisibility());

    smallBox5 = new Rectangle(x + (2 * w / 3), y + (h / 3), w / 3, h / 3);
    smallBox5.setBackground(Color.white);
    container.add(smallBox5);
    smallBox5.add(cross);
    cross.setVisible(setVisibility());
    smallBox5.add(circle);
    circle.setVisible(setVisibility());

    smallBox6 = new Rectangle(x, y + (2 * h / 3), w / 3, h / 3);
    smallBox6.setBackground(Color.white);
    container.add(smallBox6);
    smallBox6.add(cross);
    cross.setVisible(setVisibility());
    smallBox6.add(circle);
    circle.setVisible(setVisibility());

    smallBox7 = new Rectangle(x + (w / 3), y + (2 * h / 3), w / 3, h / 3);
    smallBox7.setBackground(Color.white);
    container.add(smallBox7);
    smallBox7.add(cross);
    cross.setVisible(setVisibility());
    smallBox7.add(circle);
    circle.setVisible(setVisibility());

    smallBox8 = new Rectangle(x + (2 * w / 3), y + (2 * h / 3), w / 3, h / 3);
    smallBox8.setBackground(Color.white);
    container.add(smallBox8);
    smallBox8.add(cross);
    cross.setVisible(setVisibility());
    smallBox8.add(circle);
    circle.setVisible(setVisibility());
  }
 protected void fillWithDots(Collection<Point> col, Oval o, int n) {
   for (int i = 0; i < n; i++) {
     col.add(o.getRandomPoint(col, 30));
   }
 }