if (doubleBuffer == null || (((doubleBuffer.getWidth(null) < proposedWidth) || (doubleBuffer.getHeight(null) < proposedHeight)) && (proposedWidth < doubleBufferMaximumSize.width) && (proposedHeight < doubleBufferMaximumSize.height)))
Component root = SwingUtilities.getRoot(component); Image buffer = (Image) offscreenBuffers.get(root); if (buffer == null || buffer.getWidth(null) < proposedWidth || buffer.getHeight(null) < proposedHeight)
  public Image getOffscreenBuffer(Component component, int proposedWidth,                                  int proposedHeight)  {    if (doubleBuffer == null         || (((doubleBuffer.getWidth(null) < proposedWidth)              || (doubleBuffer.getHeight(null) < proposedHeight))            && (proposedWidth < doubleBufferMaximumSize.width)            && (proposedHeight < doubleBufferMaximumSize.height)))      {        doubleBuffer = component.createImage(proposedWidth, proposedHeight);      }    return doubleBuffer;  }