Link to home
Start Free TrialLog in
Avatar of sanjay_thakur
sanjay_thakur

asked on

closing child window from a frame


hi,

I have a frame.In this frame I have a pop up menu
when the user selects "create" option from the pop up menu
I display another frame to create something

The problem is when I close the main frame I want to
dispose this second  frame

How do I do this
I tried doing this

f.addWindowListener(new WindowAdapter ()
    {
         Window [] childWindows = null;
         public void windowClosing(WindowEvent event)
         {

           System.out.println("in window closing event");

           childWindows = f.getOwnedWindows();
           System.out.println("childWindows" + childWindows.length );

           for(int i=0;i<childWindows.length;i++)
           {
          System.out.println("destroy child window");
          childWindows[i].setVisible(false);
          String name = childWindows[i].getName();
          System.out.println("name" + name);
          childWindows[i].dispose();
           }

         }

    });

This does not work.
How do I do this.




 
ASKER CERTIFIED SOLUTION
Avatar of dviji
dviji

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial