code: @Override
  	protected void paintComponent(final RenderContext renderContext) {
  		final Throwable error = (Throwable) getAttribute(ERROR_KEY);
  
  		if (error == null) {
  			if (renderContext instanceof WebXmlRenderContext) {
  				// For a WebXmlContext, we can output partial XML.
  				WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
  
  				final StringWriter buf = new StringWriter();
  				WebXmlRenderContext bufferedContext = new WebXmlRenderContext(new PrintWriter(buf));
  
  				try {
  					for (int i = 0; i < shim.getChildCount(); i++) {
  						shim.getChildAt(i).paint(bufferedContext);
  					}
  
  					webRenderContext.getWriter().write(buf.toString());
  				} catch (final Exception e) {
  					new ErrorComponent("Error during rendering", e).paint(renderContext);
  					new WHorizontalRule().paint(renderContext);
  
  					PrintWriter writer = webRenderContext.getWriter();
  					writer.println("\n<br/>Partial XML:<br/>\n<pre>\n");
  					writer.println(WebUtilities.encode(buf.toString()));
  					writer.println("\n</pre>");
  				}
  			} else {
  				try {
  					for (int i = 0; i < shim.getChildCount(); i++) {
  						shim.getChildAt(i).paint(renderContext);
  					}
  				} catch (final Exception e) {
  					new ErrorComponent("Error during rendering", e).paint(renderContext);
  					new WHorizontalRule().paint(renderContext);
  				}
  			}
  		} else {
  			new ErrorComponent("Error during action phase", error).paint(renderContext);
  		}
  	}
docs: <p>
  Override paintComponent to provide some protection against bad code when examples are being developed, resulting
  in invalid XML.</p>
  
  <p>
  Real applications should not emit HTML directly.</p>
  
  @param renderContext the RenderContext to send the output to.