Color bg = null;
Color tokenForeground; Color tokenBackground = null;
	public int paintSyntaxLine(int lineIndex, Graphics gfx, int _x, int _y,		TabExpander expander, boolean style, boolean color,		Font defaultFont, Color foreground, Color background,		SyntaxStyle[] styles, TextRenderer renderer)	{		float x = (float)_x;		float y = (float)_y;		LineInfo info = lineInfo[lineIndex];		if(info.tokensValid)		{			// have to do this 'manually'			Element lineElement = getDefaultRootElement()				.getElement(lineIndex);			int lineStart = lineElement.getStartOffset();			try			{				getText(lineStart,lineElement.getEndOffset()					- lineStart - 1,seg);			}			catch(BadLocationException e)			{				Log.log(Log.ERROR,this,e);			}		}		else			markTokens(lineIndex);		Token tokens = info.firstToken;		// the above should leave the text in the 'seg' segment		char[] text = seg.array;		int off = seg.offset;		for(;;)		{			byte id = tokens.id;			if(id == Token.END)				break;			Color bg = null;			if(id == Token.NULL)			{				gfx.setColor(foreground);				gfx.setFont(defaultFont);			}			else			{				if(style)					gfx.setFont(styles[id].getFont());				else					gfx.setFont(defaultFont);				if(color)				{					bg = styles[id].getBackgroundColor();					gfx.setColor(styles[id].getForegroundColor());				}				else					gfx.setColor(foreground);			}			int len = tokens.length;			x = renderer.drawChars(text,off,len,gfx,x,y,expander,bg);			off += len;			tokens = tokens.next;		}		return (int)x;	}