public void paint(Graphics g) {
      // This method is called by the swing thread, so may be called
      // at any time during execution...

      // First draw the background elements
      for (Element<Light> e : lightElements) {
        /*if (e.x.getState()) {
        	g.setColor(Color.BLUE);
        } else {
        	g.setColor(Color.YELLOW);
        }
        XGraphics.fillOval(g, e.t, 0, 0, MP.carLength, VP.elementWidth);*/

        g.setColor(e.x.getCurrentColor());
        XGraphics.fillRect(g, e.t, 0, 0, MP.carLength, VP.elementWidth);
      }
      g.setColor(Color.BLACK);
      for (Element<Road> e : roadElements) {
        XGraphics.fillRect(g, e.t, 0, 0, MP.roadLength, VP.elementWidth);
      }

      // Then draw the foreground elements
      for (Element<Road> e : roadElements) {
        // iterate through a copy because e.x.getCars() may change during iteration...
        for (Car d : e.x.getAllCars().toArray(new Car[0])) {
          g.setColor(d.getColor());
          XGraphics.fillOval(g, e.t, d.getPosition(), 0, MP.carLength, VP.elementWidth);
        }
      }
    }
    public void paint(Graphics g) {
      // This method is called by the swing thread, so may be called
      // at any time during execution...

      // First draw the background elements
      for (Element<Light> e : _lightElements) {
        if (e.x.getState() == LightState.GreenNS_RedEW) {
          g.setColor(Color.GREEN);
        } else if (e.x.getState() == LightState.YellowNS_RedEW) {
          g.setColor(Color.YELLOW);
        } else {
          g.setColor(Color.RED);
        }
        XGraphics.fillOval(g, e.t, 0, 0, MP.baseCarLength, VP.elementWidth);
      }
      g.setColor(Color.BLACK);
      for (Element<RoadSegment> e : _roadElements) {
        XGraphics.fillRect(g, e.t, 0, 0, MP.roadLength, VP.elementWidth);
      }

      // Then draw the foreground elements
      for (Element<RoadSegment> e : _roadElements) {
        // iterate through a copy because e.x.getCars() may change during iteration...
        for (Car d : e.x.getCars().toArray(new Car[0])) {
          g.setColor(d.getColor());
          XGraphics.fillOval(g, e.t, d.getPosition(), 0, MP.baseCarLength, VP.elementWidth);
        }
      }
    }