public void show(int location, final RelativePoint target) {
    myFrame.pack();
    Dimension frameSize = myFrame.getPreferredSize();

    final Point targetScreenPoint = target.getScreenPoint();
    Point framePoint = new Point();

    switch (location) {
      case Callout.NORTH_WEST -> {
        framePoint.x = targetScreenPoint.x - frameSize.width - getPointerShift();
        framePoint.y = targetScreenPoint.y - frameSize.height - getPointerShift();
      }
      case Callout.NORTH_EAST -> {
        framePoint.x = targetScreenPoint.x + getPointerShift();
        framePoint.y = targetScreenPoint.y - frameSize.height - getPointerShift();
      }
      case Callout.SOUTH_EAST -> {
        framePoint.x = targetScreenPoint.x + getPointerShift();
        framePoint.y = targetScreenPoint.y + getPointerShift();
      }
      case Callout.SOUTH_WEST -> {
        framePoint.x = targetScreenPoint.x - frameSize.width - getPointerShift();
        framePoint.y = targetScreenPoint.y + getPointerShift();
      }
    }

    myPointerComponent = new Pointer(location);

    final Rectangle frameBounds = new Rectangle(framePoint, frameSize);
    ScreenUtil.moveRectangleToFitTheScreen(frameBounds);

    myTargetComponent = (JComponent) target.getComponent();
    myTargetWindow = SwingUtilities.getWindowAncestor(myTargetComponent);

    final JLayeredPane layered = getLayeredPane(myTargetWindow);
    final Rectangle layeredBounds = new RelativeRectangle(layered).getScreenRectangle();

    final boolean[] outside = getOutsideAxisCodes(layeredBounds, frameBounds);
    if (outside != null) {
      boolean x = outside[0];
      boolean y = outside[1];

      switch (location) {
        case Callout.NORTH_WEST -> {
          if (x) {
            frameBounds.x = layeredBounds.x - frameBounds.width;
          }
          if (y) {
            frameBounds.y = layeredBounds.y - frameBounds.height;
          }
        }
        case Callout.NORTH_EAST -> {
          if (x) {
            frameBounds.x = (int)layeredBounds.getMaxX();
          }
          if (y) {
            frameBounds.y = layeredBounds.y - frameBounds.height;
          }
        }
        case Callout.SOUTH_EAST -> {
          if (x) {
            frameBounds.x = (int)layeredBounds.getMaxX();
          }
          if (y) {
            frameBounds.y = (int)layeredBounds.getMaxY();
          }
        }
        case Callout.SOUTH_WEST -> {
          if (x) {
            frameBounds.x = layeredBounds.x - frameBounds.width;
          }
          if (y) {
            frameBounds.y = (int)layeredBounds.getMaxY();
          }
        }
      }
    }


    Point targetLayeredPoint = target.getPoint(layered);
    Rectangle frameLayeredBounds = RelativeRectangle.fromScreen(layered, frameBounds).getRectangleOn(layered);

    Rectangle pointerBounds = new Rectangle();
    final int extraPoint = 1;
    switch (location) {
      case Callout.NORTH_WEST -> {
        pointerBounds.x = (int)frameLayeredBounds.getMaxX() - extraPoint;
        pointerBounds.y = (int)frameLayeredBounds.getMaxY() - extraPoint;
        pointerBounds.width = targetLayeredPoint.x - pointerBounds.x;
        pointerBounds.height = targetLayeredPoint.y - pointerBounds.y;
      }
      case Callout.NORTH_EAST -> {
        pointerBounds.x = targetLayeredPoint.x;
        pointerBounds.y = (int)frameLayeredBounds.getMaxY() - extraPoint;
        pointerBounds.width = frameLayeredBounds.x + extraPoint - targetLayeredPoint.x;
        pointerBounds.height = targetLayeredPoint.y - pointerBounds.y;
      }
      case Callout.SOUTH_EAST -> {
        pointerBounds.x = targetLayeredPoint.x;
        pointerBounds.y = targetLayeredPoint.y;
        pointerBounds.width = frameLayeredBounds.x + extraPoint - targetLayeredPoint.x;
        pointerBounds.height = (int)frameLayeredBounds.getMaxY() + extraPoint - targetLayeredPoint.y - frameLayeredBounds.height;
      }
      case Callout.SOUTH_WEST -> {
        pointerBounds.x = (int)frameLayeredBounds.getMaxX() - extraPoint;
        pointerBounds.y = targetLayeredPoint.y;
        pointerBounds.width = targetLayeredPoint.x - pointerBounds.x;
        pointerBounds.height = frameLayeredBounds.y + extraPoint - targetLayeredPoint.y;
      }
    }

    layered.add(myPointerComponent, JLayeredPane.POPUP_LAYER);
    myPointerComponent.setBounds(pointerBounds);

    myFrame.setBounds(frameBounds);
    myFrame.setVisible(true);

    SwingUtilities.invokeLater(() -> {
      installDisposeListeners();
      myFrame.setVisible(true);
    });
  }
public void show(int location, final RelativePoint target)