« Return to Thread: Closing a form from another one

Re: Closing a form from another one

by djohnson-2 :: Rate this Message:

Reply to Author | View in Thread

You could do it with events. Add one form as an ActionListener to the
other form. When you want the other form to set the first one
visible/invisible (or do anything else) fire an event to the listener
telling it what you want it to do.

HTH

David Johnson

On Sat, 2009-07-04 at 13:08 -0700, Jeffrey H. Coffield wrote:

>
> AlexanderPD wrote:
> > thank you for the answer :D
> >
> >
> >
> > i don't think i can do that :(
> >
> > my classes starts with:
> >
> >
> >
> > public class a extends javax.swing.JFrame
> >
> > and
> >
> > public class b extends javax.swing.JFrame
> >
> > (netbeans gui builder auto-generate that), so they both extends JFrame :(
> >
> >
> > .
> >
> >
> That doesn't prevent you from adding a new method with a parameter or
> adding a method to b that will store a reference to a that can then be
> called to set setVisble to false.
>
> There may be a better way to do this, and if someone else has an idea,
> I'd also like to know.
>
> Jeff Coffield
>
> Jeff
>

 « Return to Thread: Closing a form from another one