Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing Internal Frames  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class file with functions for opening several internal frames that can be called from any class. That way, I am able to open an internal frame by hitting a button inside an internal frame and a new frame comes onto the main desktop(not inside the already present internalframe). Anyaway, my problems is that sometimes I need to close both windows at the same time by clicking on button from inside one of the internal frames. And I don't know if a WindowListener will do that or how to if it does function that way. Can anyone help?
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm not so tough. subclass your desktop and just extend windowlistener in it. Then use your desktop as the window listener for your first internal window. Keep references to them both in your subclassed desktop. Then when the first one closes(and meets certain conditions if necessary) then call a close on the second one.
Hope this helps(and makes sense)
Chris
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that makes a lot of sense. Problem though is that I am having a real hard time with Listeners. Do you know of any code examples that do something similar? I have looked on java.sun and they have some examples but only for iconifying and the like. Thanks for any help!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!