Computer Science Canada

Frame Closing

Author:  Regeane [ Thu Jun 01, 2006 3:00 pm ]
Post subject:  Frame Closing

Is there a way to have the frame close [or be setVisible(false)] when a button is pressed if the actionPerformed method is not in the same class as the frame was first initialized?

Author:  rizzix [ Thu Jun 01, 2006 3:58 pm ]
Post subject: 

hmm.. yea.. as long as you have a reference to that frame.. you can do anything to it..

Author:  Regeane [ Thu Jun 01, 2006 4:48 pm ]
Post subject: 

Hmm... how would one go about getting a reference??

Author:  GodofOsiris [ Mon Jun 19, 2006 2:25 pm ]
Post subject: 

All you would have to do in the actionPerformed method is when the buttons clicked use this line of code

code:
System.exit(0);

Author:  [Gandalf] [ Mon Jun 19, 2006 4:39 pm ]
Post subject: 

No need to reply to 2 month old topics. Read the rules found here, specifically the last one about necro posting.


: