private void draw(Graphics g) {
		synchronized(pt){
			log.logln(LogL.GUI_SEQ, "GraphPanel.draw(): draw imgSize=(" + imageSizeX + "," + imageSizeY + ")");
			if(defaultViewOnNextDraw) {
				defaultViewWithoutRedraw();
				defaultViewOnNextDraw = false;
			}
			
			g.clearRect(0, 0, imageSizeX, imageSizeY);
			pt.drawBackground(g);
			
			if(Configuration.useMap){
				Runtime.map.paintMap(g, pt);
			}
	
			g.setColor(Color.BLACK);
			
			// Draw the graph
			try{
				// First draw all edges, only then the nodes
				Enumeration<Node> nodeEnumer;
				if(Configuration.drawEdges) {
					nodeEnumer = Runtime.nodes.getSortedNodeEnumeration(true);
					while(nodeEnumer.hasMoreElements()){
						Node node = nodeEnumer.nextElement();
						// first draw all outgoing edges of this node
						Iterator<Edge> edgeIter = node.outgoingConnections.iterator();
						while(edgeIter.hasNext()){
							Edge e = edgeIter.next();
							e.draw(g, pt);
						}
					}
				}
				// Draw the nodes in a separate loop
				if(Configuration.drawNodes) {
					// Draw the nodes in a separate loop
					nodeEnumer = Runtime.nodes.getSortedNodeEnumeration(true);
					while(nodeEnumer.hasMoreElements()){
						Node node = nodeEnumer.nextElement();
						node.draw(g, pt, false);
					}
				}
			} 
			catch(ConcurrentModificationException eME){
				//catch the concurrent modification exception from the iterators of the drawing. Do not do anything when it is thrown.
				//We don't care, when this exception is thrown because this only happens when someone is zooming in the middle of a 
				//round. It only happens if an edge is added or removed from a node during redrawing. Catching this exception and not
				//doing anything results in a wrong picture during zooming (when there was a concurrentModificationException) and we
				//decided that it is not worth the slowdown of the simulation just to always get a correct picture.
			}
			
			if(Configuration.showMessageAnimations) {
				Animations.drawEnvelopes(g, pt);
			}
			
			// perform the custom drawing. Note that the custom paint is only called when also the
			// entire graph was painted. This ensures that there should be no conflict due to any
			// concurrent data accesses
			Global.customGlobal.customPaint(g, pt);
		}
	}