public void highlightLine(final int lineNum) {
		final Highlighter high = getHighlighter();

		final Document d = getDocument();

		int line = 0;
		int posStart = 0;
		int pos = 0;
		int lineTermLength = 0;

		try {

			while ( line < lineNum ) {
				posStart = pos;
				lineTermLength = 0;
				
				// Find the end of a line (or end of string)
				while ( pos < d.getLength() ) {
	    			char c = d.getText(pos, 1).charAt(0);
	    			pos++;
	
	    			if ( c == '\r' ) {
	    				lineTermLength = 1;
	    				
	    				if ( pos < d.getLength() && d.getText(pos, 1).charAt(0) == '\n' ) {
	    					pos++;
	    					lineTermLength = 2;
	    				}
	
	    				break;
	    			} else if ( c == '\n') {
	    				lineTermLength = 1;
	    				break;
	    			}
				}
				line++;
			}
			
			pos -= lineTermLength;
	
			assert posStart >= 0;
			assert pos >= posStart;
			assert pos <= d.getLength();

			high.addHighlight(posStart, pos, painter);
		
			repaint();

		} catch (BadLocationException e1) {}

	}