@Override
	public void paintComponent(Graphics g)
	{
		super.paintComponent(g);
		paintBackground(g);

		if (graphComponent != null)
		{
			// Creates or destroys the triple buffer as needed
			if (tripleBuffered)
			{
				checkTripleBuffer();
			}
			else if (tripleBuffer != null)
			{
				destroyTripleBuffer();
			}

			// Updates the dirty region from the buffered graph image
			if (tripleBuffer != null)
			{
				if (repaintBuffer)
				{
					repaintTripleBuffer(null);
				}
				else if (repaintClip != null)
				{
					repaintClip.grow(1 / scale);

					repaintClip.setX(repaintClip.getX() * scale + translate.x);
					repaintClip.setY(repaintClip.getY() * scale + translate.y);
					repaintClip.setWidth(repaintClip.getWidth() * scale);
					repaintClip.setHeight(repaintClip.getHeight() * scale);

					repaintTripleBuffer(repaintClip.getRectangle());
				}

				mxUtils.drawImageClip(g, tripleBuffer, this);
			}

			// Paints the graph directly onto the graphics
			else
			{
				paintGraph(g);
			}

			paintForeground(g);
		}
	}