@Override
    public Popup getPopup(Component owner, Component contents, int x, int y) {
        Popup popup = super.getPopup(owner, contents, x, y);
        // If the popup component is contained in a heavy weight window,
        // make that window's background transparent.
        Window popupWindow = SwingUtilities.getWindowAncestor(contents);
        if (popupWindow != null) {
            popupWindow.setBackground(new Color(0, 0, 0, 0));
        }
        Container parent = contents.getParent();
        if (parent instanceof JComponent) {
            JComponent p = (JComponent) parent;
            p.setOpaque(false);
            p.setBorder(POPUP_SHADOW_BORDER);
            p.setSize(p.getPreferredSize());
            if (contents instanceof JToolTip
                    && ((JToolTip) contents).getBorder() instanceof AeroToolTipBorder) {
                // Aero tool tip has round corners, so we add a small "patch"
                // to the bottom-right corner to get rid of the noisy point.
                p.setLayout(null);
                Dimension size = contents.getPreferredSize();
                contents.setBounds(0, 0, size.width, size.height);
                PATCH.setBackground(POPUP_SHADOW_BORDER.getDark().brighter());
                p.add(PATCH);
                PATCH.setBounds(p.getWidth() - 5, p.getHeight() - 5, 1, 1);
            }
        }
        return popup;
    }