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);
      } */
      
    	for (Element<Intersection> e : _intersectionElements) {
            if (e.x.getLightControl().getState() == LightState.GreenNS_RedEW) {
              g.setColor(Color.GREEN);
            } else if(e.x.getLightControl().getState() == LightState.YellowNS_RedEW) {
              g.setColor(Color.YELLOW);
            } else {
              g.setColor(Color.RED);
            }
            
            for (Vehicle d : e.x.getCars().toArray(new Vehicle[0])) {
                g.setColor(d.getColor());
                XGraphics.fillOval(g, e.t, normalizeVehicleValueIntersection(d.getPosition(), e.x), 0, normalizeVehicleValueIntersection(d.getLength(), e.x), VP.elementWidth);
             }
            XGraphics.fillOval(g, e.t, 0, 0, MP.baseCarLength, VP.elementWidth);
    	}	
    	
      g.setColor(Color.BLACK);
      for (Element<VehicleAcceptor> e : _roadElements) {
        XGraphics.fillRect(g, e.t, 0, 0, MP.baseRoadLength, VP.elementWidth);
      }
      
      // Then draw the foreground elements
      for (Element<VehicleAcceptor> e : _roadElements) {
        // iterate through a copy because e.x.getCars() may change during iteration...
        for (Vehicle d : e.x.getCars().toArray(new Vehicle[0])) {
          g.setColor(d.getColor());
          XGraphics.fillOval(g, e.t, normalizeVehicleValue((d.getPosition() - d.getLength() ) , e.x), 0, normalizeVehicleValue(d.getLength(), e.x), VP.elementWidth);
        }
      }
    }