public void copyFrameBufferToImage(RenderManager renderManager) {

    while (!frameState.compareAndSet(WAITING_STATE, RUNNING_STATE)) {
      if (frameState.get() == DISPOSED_STATE) {
        return;
      }
    }

    // Convert screenshot.
    try {

      frameByteBuffer.clear();

      final Renderer renderer = renderManager.getRenderer();
      renderer.readFrameBufferWithFormat(frameBuffer, frameByteBuffer, Image.Format.RGBA8);

    } finally {
      if (!frameState.compareAndSet(RUNNING_STATE, WAITING_STATE)) {
        throw new RuntimeException("unknown problem with the frame state");
      }
    }

    synchronized (byteBuffer) {
      frameByteBuffer.get(byteBuffer);

      if (transferMode == TransferMode.ON_CHANGES) {

        final byte[] prevBuffer = getPrevImageByteBuffer();

        if (Arrays.equals(prevBuffer, byteBuffer)) {
          if (frameCount == 0) return;
        } else {
          frameCount = 2;
          System.arraycopy(byteBuffer, 0, prevBuffer, 0, byteBuffer.length);
        }

        frameByteBuffer.position(0);
        frameCount--;
      }
    }

    EventQueue.invokeLater(new Runnable() {

      @Override
      public void run() {
        writeFrame();
      }});
  }
Copy the JMonkey frame buffer that has been rendered by the JMonkey engine and schedule the rendering of the component.
@param renderManager the JMonkey render manager.
jme3-desktop/src/main/java/com/jme3/system/AWTComponentRenderer.java