• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hiding Parent Window Onclick

 
Ramesh Jothimani
Ranch Hand
Posts: 70
Android Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> "Welcome to SHKFI Installation Wizard"

set everything up as a CardLayout
 
Ramesh Jothimani
Ranch Hand
Posts: 70
Android Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic