public void paintLineHighlights(Graphics g) {

		int count = lineHighlights==null ? 0 : lineHighlights.size();
		if (count>0) {

			int docLen = textArea.getDocument().getLength();
			Rectangle vr = textArea.getVisibleRect();
			int lineHeight = textArea.getLineHeight();

			try {

				for (int i=0; i<count; i++) {
					LineHighlightInfo lhi =(LineHighlightInfo)
													lineHighlights.get(i);
					int offs = lhi.getOffset();
					if (offs>=0 && offs<=docLen) {
						int y = textArea.yForLineContaining(offs);
						if (y>vr.y-lineHeight) {
							if (y<vr.y+vr.height) {
								g.setColor(lhi.getColor());
								g.fillRect(0,y, textArea.getWidth(),lineHeight);
							}
							else {
								break; // Out of visible rect
							}
						}
					}
				}

			} catch (BadLocationException ble) { // Never happens
				ble.printStackTrace();
			}
		}

	}