• Post Reply Bookmark Topic Watch Topic
  • New Topic

about the addWindowListener()

 
Jian Zhang
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is here:
I have two frames, one calls another. the child jframe modifies a text file which is displayed in the parent jframe. I want to Update this change when I close the child jframe. How should I do it?
I checked some related topics about the getting sub-window handle. seems I need a listener to listener to the closing event to achieve it. anybody has any idea? Thanks a lot.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the examples in this post... main frame launches child frames that affect the parent.
 
Jason Steele
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like what you want is commonly referred to as a callback. Java doesn't have callbacks in the traditional sense....However you can implement an interface to get the same result. Or, if this is a one-time deal you could just pass the parent as a Constructor argument.
basically:

Then in the parent... do the following


is this what you're looking for?

Good Luck
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!