Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :-)
 
KR Campbell
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic