}
if(paintLabels){
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHints(hints);
Dimension displaySize = getContext().getImageSize();
cache.end(g, new Rectangle(displaySize));
}
//update the context with the new image
((RenderContextImpl)getContext()).setImage(copy);
} catch (IllegalStateException e) {