protected void paintSelection(Graphics graphics) {
		if (selectionStart == -1)
			return;
		graphics.setXORMode(true);
		graphics.setBackgroundColor(ColorConstants.white);

		TextFragmentBox frag;
		for (int i = 0; i < fragments.size(); i++) {
			frag = (TextFragmentBox) fragments.get(i);
			// Loop until first visible fragment
			if (frag.offset + frag.length <= selectionStart)
				continue;
			if (frag.offset > selectionEnd)
				return;
			if (selectionStart <= frag.offset
					&& selectionEnd >= frag.offset + frag.length) {
				int y = frag.getLineRoot().getVisibleTop();
				int height = frag.getLineRoot().getVisibleBottom() - y;
				graphics.fillRectangle(frag.getX(), y, frag.getWidth(), height);
			} else if (selectionEnd > frag.offset
					&& selectionStart < frag.offset + frag.length) {
				Point p1 = getPointInBox(frag,
						Math.max(frag.offset, selectionStart), i, false);
				Point p2 = getPointInBox(frag,
						Math.min(frag.offset + frag.length, selectionEnd) - 1,
						i, true);
				Rectangle rect = new Rectangle(p1, p2);
				rect.width--;
				rect.y = frag.getLineRoot().getVisibleTop();
				rect.height = frag.getLineRoot().getVisibleBottom() - rect.y;
				graphics.fillRectangle(rect);
			}
		}
	}