public void paint(Graphics g) {
		if (root == null)
			return; // No tree to draw.

		Graphics2D g2 = (Graphics2D) g;
		Dimension d = getSize();
		g2.setPaint(Color.white);
		g2.fill(new Rectangle2D.Double(0, 0, d.width, d.height));

		// Avoid division by zero if only one level in tree.
		int depth = (getDepth() == 1 ? 2 : getDepth());

		TreeNode<E> leftmost = root;
		while (leftmost.left != null)
			leftmost = leftmost.left;
		TreeNode<E> rightmost = root;
		while (rightmost.right != null)
			rightmost = rightmost.right;

		// Compute the size of the text
		FontMetrics font = g2.getFontMetrics();
		int leftPad = font.stringWidth(leftmost.data + "") / 2;
		int rightPad = font.stringWidth(rightmost.data + "") / 2;
		int textHeight = font.getHeight();

		int minX = leftPad + ARC_PAD;
		int maxX = d.width - rightPad - ARC_PAD;
		int yInit = textHeight / 2 + ARC_PAD;
		int yIncrement = (d.height - textHeight - 2 * ARC_PAD) / (depth - 1);
		drawTree(g2, root, minX, maxX, yInit, yIncrement);
	}

	// Draws the tree starting at t, with x = {minX, ..., maxX}