int lastVisibleLine = textArea.getFirstLine() + textArea.getVisibleLines(); int lastLine = textArea.getLineCount();
int lastVisibleLine = Math.min(textArea.getLineCount(), textArea.getFirstLine() + textArea.getVisibleLines());
	protected int paintLine(Graphics gfx, int line, int x)	{		TokenMarker tokenMarker = textArea.getTokenMarker();		Font defaultFont = getFont();		Color defaultColor = getForeground();						int y = textArea.lineToY(line);		if(line < 0 || line >= textArea.getLineCount())		{			paintHighlight(gfx,line,y);			styles[Token.INVALID].setGraphicsFlags(gfx,defaultFont);			gfx.drawString("~",0,y + getFontMetrics().getHeight());			return 1;		}		if(tokenMarker == null)		{			currentLineIndex = line;			paintPlainLine(gfx,line,defaultFont,defaultColor,x,y);			return 1;		}		else		{			int count = 0;			int lastVisibleLine = textArea.getFirstLine()				+ textArea.getVisibleLines();			int lastLine = textArea.getLineCount();			do			{				currentLineIndex = line + count;				paintSyntaxLine(tokenMarker,gfx,line + count,					defaultFont,defaultColor,x,y);				y += getFontMetrics().getHeight();				count++;			}			while(tokenMarker.isNextLineRequested()				&& line + count < lastVisibleLine);			return count;		}	}