aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Hiding Parent Window Onclick Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Hiding Parent Window Onclick" Watch "Hiding Parent Window Onclick" New topic
Author

Hiding Parent Window Onclick

Ramesh Jothimani
Ranch Hand

Joined: May 05, 2011
Posts: 70

My Application flow is as follows : I have a button in my main window . On clicking the button , the new window should appear and the current window should hide.

Code of Parent Window :




Child Window :



I need to call second window on clicking continue button . The Parent window is not getting hided . Both Windows appear. How can I hide my parent window ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18656
    
    8

This line of code:



sets the JPanel inside your "parent" window to be not visible. It doesn't affect the "parent" window at all. You need to have a reference to that window and call setVisible(false) on that reference.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> "Welcome to SHKFI Installation Wizard"

set everything up as a CardLayout
Ramesh Jothimani
Ranch Hand

Joined: May 05, 2011
Posts: 70

Paul Clapham wrote:This line of code:



sets the JPanel inside your "parent" window to be not visible. It doesn't affect the "parent" window at all. You need to have a reference to that window and call setVisible(false) on that reference.


It hides my JPanel & a blank screen is there on the back . I am beginner to Java Swing . How can I make reference to that Window and hide it in button click?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hiding Parent Window Onclick