StringBuffer buf = new StringBuffer(); for (int i = 0; i < messages.size() ; i++) { buf.append(((UserMessage) messages.get(i)).message); buf.append("\n"); } textArea.setText(buf.toString()); myGraphics.translate(visRect.x, visRect.y); textArea.paint(myGraphics); myGraphics.translate(-visRect.x, -visRect.y);
	protected void paintComponent(java.awt.Graphics g) {	    /*	     * Swing Javadoc states that we shouldn't leave the Graphics	     * context in an altered state, so we make a copy here instead	     */	    Graphics myGraphics = g.create();	    paintStats.enter();	    super.paintComponent(myGraphics);	    if (null != mapCursor) {		mapCursor.cursorRenderer.paintCursor(myGraphics,			new java.awt.Dimension(30, 30));	    }	    /* display any user messages */	    long now = System.currentTimeMillis();	    UserMessage m;	    // remove all older than 5 seconds	    while (!messages.isEmpty() &&		    ((UserMessage) messages.get(0)).createdOn + 5000 < now)		messages.removeFirst();	    Rectangle visRect = this.getVisibleRect();	    if (! messages.isEmpty()) {		if (textAreaWidth != visRect.width ||			textAreaHeight != visRect.height) {		    textAreaWidth = visRect.width;		    textAreaHeight = visRect.height;		    textArea.setSize(textAreaWidth, textAreaHeight);		}		StringBuffer buf = new StringBuffer();		for (int i = 0; i < messages.size() ; i++) {		    buf.append(((UserMessage) messages.get(i)).message);		    buf.append("\n");		}		textArea.setText(buf.toString());		myGraphics.translate(visRect.x, visRect.y);		textArea.paint(myGraphics);		myGraphics.translate(-visRect.x, -visRect.y);	    }	//	    myGraphics.drawString(this.userMessage[i], 10+visRect.x,	//		    10+visRect.y+i*20);	    paintStats.exit();	    	    if (frameRate) {		myGraphics.translate(visRect.x, visRect.y);		fpsCounter.updateFPSCounter(myGraphics);	    }	    	    /* dispose of the graphics context */		    myGraphics.dispose();	}