private static Rectangle getShadowBounds(Point point, Window window) {
    if (!window.isShowing()) return null;
    if (!window.isDisplayable()) return null;
    if (window instanceof Frame frame) {
      if (!frame.isUndecorated()) return null;
    }
    if (window instanceof Dialog dialog) {
      if (!dialog.isUndecorated()) return null;
    }
    if (window instanceof RootPaneContainer container) {
      JRootPane root = container.getRootPane();
      if (root != null) {
        Object property = root.getClientProperty("Window.shadow");
        if (property instanceof Boolean && !(Boolean)property) return null;
      }
    }
    Rectangle bounds = window.getBounds();
    if (bounds.isEmpty()) return null;

    bounds.x -= Left.getIconWidth() + point.x;
    bounds.y -= Top.getIconHeight() + point.y;
    bounds.width += Left.getIconWidth() + Right.getIconWidth();
    bounds.height += Top.getIconHeight() + Bottom.getIconHeight();
    return bounds;
  }
private static Rectangle getShadowBounds(Point point, Window window)