JRootPane rootPane = SwingUtilities.getRootPane(owner); JLayeredPane layeredPane = rootPane.getLayeredPane();
    public void hide()    {      JRootPane rootPane = SwingUtilities.getRootPane(owner);      JLayeredPane layeredPane = rootPane.getLayeredPane();      layeredPane.remove(panel);    }