wood burning stoves 2.0*
The moose likes Java in General and the fly likes JFrame.dispose() : seeking clarity on a feature! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JFrame.dispose() : seeking clarity on a feature!" Watch "JFrame.dispose() : seeking clarity on a feature!" New topic
Author

JFrame.dispose() : seeking clarity on a feature!

achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi.
I've an applet that launches a JFrame, which inturns throws another JFrame.
They cascade three levels i.e. FirstFrame throws SecondFrame, and SecondFrame throws ThirdFrame.

The firstFrame f is disposed and GC-ed, but the applet persists and scndFrame pops up

Second frame ff is now disposed and GC-ed, leaving only the third frame

There are 3 JButtons in the third frame fff.
If the user clicks on "cancel" fff will be disposed.
It works BUT only for one fff!
If I have two or more fff up on the screen, the cancel button works only on the first fff.
Oddly, the cancel button always works on ff, regardless of the number of ff that I've popped up.
The difference in coding is this:
* ff code is part of the applet (scndFrame)
* fff is external to SecondFrame
I hope I've explained that well.
I would sure like to know why the cancel button works on one and one only fff if I have two or more fff popped up.
TIA :-)


humanum errare est.
KR Campbell
Ranch Hand

Joined: Mar 26, 2004
Posts: 124
Did you remember to add an ActionListener to each cancel button in each frame? Also wasn't quite sure why you are extending JFrame as well as having private instances of JFrames.
Kenny
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JFrame.dispose() : seeking clarity on a feature!
 
Similar Threads
i created 2 frames, how to call another frame from the first.
getApplet() throws incompatible type error ?
System.out.println not responding ?
Totally baffled with ArrayList throwing NullPOinterException !
howto: return class of Hashtable