private boolean prepare(JComponent c,Container root,boolean isPaint,int x,int y,int w,int h){
  if (bsg != null) {
    bsg.dispose();
    bsg=null;
  }
  bufferStrategy=null;
  if (root != null) {
    boolean contentsLost=false;
    BufferInfo bufferInfo=getBufferInfo(root);
    if (bufferInfo == null) {
      contentsLost=true;
      bufferInfo=new BufferInfo(root);
      bufferInfos.add(bufferInfo);
      if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
        LOGGER.finer("prepare: new BufferInfo: " + root);
      }
    }
    this.bufferInfo=bufferInfo;
    if (!bufferInfo.hasBufferStrategyChanged()) {
      bufferStrategy=bufferInfo.getBufferStrategy(true);
      if (bufferStrategy != null) {
        bsg=bufferStrategy.getDrawGraphics();
        if (bufferStrategy.contentsRestored()) {
          contentsLost=true;
          if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
            LOGGER.finer("prepare: contents restored in prepare");
          }
        }
      }
 else {
        return false;
      }
      if (bufferInfo.getContentsLostDuringExpose()) {
        contentsLost=true;
        bufferInfo.setContentsLostDuringExpose(false);
        if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
          LOGGER.finer("prepare: contents lost on expose");
        }
      }
      if (isPaint && c == rootJ && x == 0 && y == 0 && c.getWidth() == w && c.getHeight() == h) {
        bufferInfo.setInSync(true);
      }
 else       if (contentsLost) {
        bufferInfo.setInSync(false);
        if (!isRepaintingRoot()) {
          repaintRoot(rootJ);
        }
 else {
          resetDoubleBufferPerWindow();
        }
      }
      return (bufferInfos != null);
    }
  }
  return false;
}

private boolean prepare ( JComponent c , Container root , boolean isPaint , int x , int y , int w , int h ) { if ( bsg != null ) { bsg . dispose ( ) ; bsg = null ; } bufferStrategy = null ; if ( root != null ) { boolean contentsLost = false ; BufferInfo bufferInfo = getBufferInfo ( root ) ; if ( bufferInfo == null ) { contentsLost = true ; bufferInfo = new BufferInfo ( root ) ; bufferInfos . add ( bufferInfo ) ; if ( LOGGER . isLoggable ( PlatformLogger . Level . FINER ) ) { LOGGER . finer ( "prepare: new BufferInfo: " + root ) ; } } this . bufferInfo = bufferInfo ; if ( ! bufferInfo . hasBufferStrategyChanged ( ) ) { bufferStrategy = bufferInfo . getBufferStrategy ( true ) ; if ( bufferStrategy != null ) { bsg = bufferStrategy . getDrawGraphics ( ) ; if ( bufferStrategy . contentsRestored ( ) ) { contentsLost = true ; if ( LOGGER . isLoggable ( PlatformLogger . Level . FINER ) ) { LOGGER . finer ( "prepare: contents restored in prepare" ) ; } } } else { return false ; } if ( bufferInfo . getContentsLostDuringExpose ( ) ) { contentsLost = true ; bufferInfo . setContentsLostDuringExpose ( false ) ; if ( LOGGER . isLoggable ( PlatformLogger . Level . FINER ) ) { LOGGER . finer ( "prepare: contents lost on expose" ) ; } } if ( isPaint && c == rootJ && x == 0 && y == 0 && c . getWidth ( ) == w && c . getHeight ( ) == h ) { bufferInfo . setInSync ( true ) ; } else if ( contentsLost ) { bufferInfo . setInSync ( false ) ; if ( ! isRepaintingRoot ( ) ) { repaintRoot ( rootJ ) ; } else { resetDoubleBufferPerWindow ( ) ; } } return ( bufferInfos != null ) ; } } return false ; }
calculates information common to paint / copyarea .
