protected void deliverMoveResizeEvent(int x, int y, int width, int height, boolean byUser) {
    checkZoom();

    final Rectangle oldB = nativeBounds;
    nativeBounds = new Rectangle(x, y, width, height);
    if (peer != null) {
      peer.notifyReshape(x, y, width, height);
      // System-dependent appearance optimization.
      if ((byUser && !oldB.getSize().equals(nativeBounds.getSize())) || isFullScreenAnimationOn) {
        flushBuffers();
      }
    }
  }
 void flushBuffers() {
   if (isVisible() && !nativeBounds.isEmpty() && !isFullScreenMode) {
     try {
       LWCToolkit.invokeAndWait(
           new Runnable() {
             @Override
             public void run() {
               // Posting an empty to flush the EventQueue without blocking the main thread
             }
           },
           target);
     } catch (InvocationTargetException e) {
       e.printStackTrace();
     }
   }
 }