public void setVisible(boolean visible) { if (!visible && myView != null) { disposeAndUpdate(false); } else if (visible && myView == null) { Window owner = UIUtil.getWindow(myOwner); if (owner != null) { if (myHeavyWeight) { Window view = pop(owner); if (view == null) { view = new JWindow(owner); setPopupType(view); } setAlwaysOnTop(view, myAlwaysOnTop); setWindowFocusable(view, myWindowFocusable); setWindowShadow(view, myWindowShadow); 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); } myView.setBackground(UIUtil.getLabelBackground()); myView.setBounds(myViewBounds); myView.setVisible(true); myViewBounds = null; } } }