public void setVisible(boolean visible) {
    Window owner = ComponentUtil.getWindow(myOwner);
    if (!visible && myView != null) {
      disposeAndUpdate(false);
      if (owner != null) {
        owner.removeWindowFocusListener(myWindowFocusAdapter);
      }
    }
    else if (visible && myView == null) {
      if (owner != null) {
        owner.addWindowFocusListener(myWindowFocusAdapter);
        if (myHeavyWeight) {
          JWindow view = new JWindow(owner);
          view.setType(Window.Type.POPUP);
          if (StartupUiUtil.isWaylandToolkit()) {
            // Wayland popups *must* know their parent in order to be
            // placed on the screen relative to it.
            try {
              Field field = Window.class.getDeclaredField("popupParent");
              field.setAccessible(true);
              field.set(view, owner);
            }
            catch (NoSuchFieldException| IllegalAccessException ignore) {
            }
          }
          setAlwaysOnTop(view, myAlwaysOnTop);
          setWindowFocusable(view, myWindowFocusable);
          setWindowShadow(view, myWindowShadow);
          view.setAutoRequestFocus(false);
          view.setFocusable(false);
          view.setFocusableWindowState(false);
          if (myTransparent && SystemInfoRt.isMac) {
            try {
              Field field = JRootPane.class.getDeclaredField("useTrueDoubleBuffering");
              field.setAccessible(true);
              field.set(view.getRootPane(), false);
            }
            catch (NoSuchFieldException| IllegalAccessException ignore) {
            }
          }
          myView = view;
        }
        else if (owner instanceof RootPaneContainer) {
          JLayeredPane parent = ((RootPaneContainer)owner).getLayeredPane();
          if (parent != null) {
            JPanel view = new JPanel(new BorderLayout());
            view.setVisible(false);
            parent.add(view, JLayeredPane.POPUP_LAYER, 0);
            myView = view;
          }
        }
      }
      if (myView != null) {
        myView.add(myContent);
        Component parent = myView instanceof Window ? null : myView.getParent();
        if (parent != null) {
          Point location = myViewBounds.getLocation();
          SwingUtilities.convertPointFromScreen(location, parent);
          myViewBounds.setLocation(location);
        }
        boolean isTranslucencySupported =
          !(myView instanceof Window) ||
          GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
            .isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSLUCENT);
        myView.setBackground(myTransparent && isTranslucencySupported ? Gray.TRANSPARENT : UIUtil.getLabelBackground());
        myView.setBounds(myViewBounds);
        myView.setVisible(true);
        myViewBounds = null;
        myOwner.addHierarchyListener(myListener);
      }
    }
  }
public void setVisible(boolean visible)