How to find JDialog(s) that have JFrame owner

I have an application with a single JFrame container, holding a JPanel which represents one functional component in the app suite. When I get a RuntimeException, I want to close the current JPanel and return the application to a login prompt. That much I can handle.
I call frame.removeAll() to remove all the components in the frame. However, in a situation where a dialog is displayed, which may in turn launch another dialog, removeAll() does not dismiss or dispose any JDialogs which have this frame as the owner, or are descendants of this frame..
Is there a way to do this? Also, (of course) the second -nth dialog would have the n-1 dialog as its owner.
I thought of finding the focus, getting its parent that is a JDialog, and calling dispose, until I get to the JFrame. However, SwingUtilities.findFocusOwner(frame) returns null on the 1st call.

Calling frame.removeAll() only removes the components contained within it, which in this case are the components that were added to its rootpane. It will not dispose of your dialogs, even if the frame is the "parent" to those dialogs. This is because those dialogs only contain a reference to the parent (frame, in this case), but the frame itself doesn't know that those dialogs are holding references to it.
The solution here is to explicitly dispose of those dialogs next to the code where you call frame.removeAll(), meaning that you should also keep references to those dialog objects so that you can make calls to dispose of them.
Or, if you want a custom removeAll() method on frame to dispose of those dialogs, then make an object which: 1) extends from JFrame, 2) holds references to those dialogs, and 3) overrides the removeAll() method to call super.removeAll() and then makes calls to dispose of those dialogs.

Similar Messages

  • How to find all photos that have NO faces, as opposed to UNNAMED faces?

    I find that iPhoto often misses faces entirely, especially if the face is wearing sunglasses or a hat or both.  Sometimes it is rather inexplicable that it has missed a face, as the face seems obvious.
    If you use the smart album method to find all "unnamed" faces, the photos have at least one unnamed face identified.  You can then add any missed faces to those photos.
    But what about photos in which iPhoto has failed to identify the existence of even one face?  Or for that matter, if I want to see only pictures of landscapes or objects that have no people?  Does anyone have a method for finding all photos that have no faces in them at all?
    For me, the idea is to find all unidentified faces and add them.  But as I pointed out above, there may be other uses for this.
    Any ideas, anyone?
    Thanks

    Awesome !!! Thank you very much. I did not realize you could use JavaScript to code against iTunes ...
    I don't know if you have written any of these yourself, but do you know how to maybe create a smart playlist with this information via script? If not, no big deal. At least I know have something which I can use, I will just have to run it every so often.
    Thanks again for pointing me to that site!

  • How to find PDF files that have other documents bundeled within them?

    Hello guys
    I need help with the following: we have a huge number of PDF files that have other documents imbedded (bundled, attached) in them. If such a document is open in Acrobat, bundled files show up as attachments on the left. Some of those attachements are .mdi files. This is Microsoft Document Images files. Is there a way to flag PDF's that have those .mdi files in them? I need to find them and convert to PDF. If I need to be more descriptive please ask, and thank you in advance for help.

    Preflight is a complex plugin, it's hard to explain how to use it in one forum post. You need to read the documentation carefully.
    There's no pre-built profile for what you want, so you would first create a new Custom Check that compares the MIME type string of embedded files to what you're searching for (not the file extension but the full MIME identifier, which for Office files is a very long string). You would then place that new Custom Check into a new Profile, identifying it as an error condition. Once you've saved the Profile you can run it against a number of files and specify actions to be taken for pass and fail conditions, such as changing the filename or moving to a subfolder.

  • I need to be able to find domain controllers that have been removed from the domain but never demoted

    I need to find domain controllers that have been removed but never demoted.
    Here's the story...
    I came on an Active Directory administrator for an organization which has 600+ domain controllers, most running Server 2003, but I have some Server 2008R2. Throughout all this time the organization has had DCs that have stopped working, crashed or failed
    for some reason and all the IT department has done is created another domain controller name it the same thing with an (A), (B) appended to the name and then never removed any of the failed controllers from the directory.
    Thing is this has been going on for quite some time, don’t know for sure how long as I am still trying to clean up DNS replication problems and have been having to go around and reset machine passwords for the forest. What I need to be able to do is to script
    something that will return all the failed DCs so that I can go into the directory and use NTDUTIL to clean the machines. I don’t want to go into the directory and remove a machine that’s still out there. No one in the organization has a list or record of failed
    machines.
    You can see this may be a gargantuan task, but I need to be able to make it easier on 
    myself by finding the machines first and cleaning out DNS, cleaning the DCs out of the “Sites” and cleaning them out of the directory.
    Appreciate any help I can get…

    Hi,
    Thanks for posting in the forum.
    Regarding your question, maybe we should remove these orphaned DC from AD, please try to refer to the following articles to perform the cleanup task.
    How to remove completely orphaned Domain Controller
    http://support.microsoft.com/kb/555846
    Complete Step by Step to Remove an Orphaned Domain controller
    http://msmvps.com/blogs/acefekay/archive/2010/10/05/complete-step-by-step-to-remove-an-orphaned-domain-controller.aspx
    Metadata Cleanup of a Domain controller
    http://sandeshdubey.wordpress.com/2011/10/12/metadata-cleanup-of-a-domain-controller/
    Here is a similar thread as reference, hope it helps.
    Remove References of a Failed DC/Domain
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/87516188-731a-4b7f-a4cc-06ce4ad27b19/remove-references-of-a-failed-dcdomain
    Best Regards,
    Andy Qi
    TechNet Subscriber Support
    If you are
    TechNet Subscription user and have any feedback on our support quality, please send your feedback
    here.
    Andy Qi
    TechNet Community Support

  • How to find the message that processed a file

    Dear guys,
    I need to find the message that have processed a text file. Using sxmb_moni  I can see this information on DynamicConfiguration log but I don't know how to search this string text in all messages that were processed.
    Thanks,
    Helio Paixao

    Hi Paixao,
    As michal you need to have the EhP1 (enhancement package 1 for PI)  or if you have installed trex then you can see this blog on how to find:
    /people/prasad.illapani/blog/2005/11/14/payload-based-message-search-in-xi30-using-trex-engine
    Else some other nonstandard ways through which you can get are shown in this blogs:
    /people/sravya.talanki2/blog/2006/02/21/abap-based-trex-in-xi-proto
    /people/alessandro.guarneri/blog/2006/02/14/super-message-monitor-for-sap-xi
    Regards.
    ---Satish

  • How to find the file that delete from time capsule?

    How to find the file that delete from time capsule?

    I mean I saved JPEG file in Time capsule and unfortunately delete the file. Can I get it back
    IF.... .no other backups have occured since you deleted the file, you might be able to retrieve it using an application like Disk Warrior. It's about $100 as I recall, and there are no guarantees that it will work.
    DiskWarrior 4 - The Disk Utility for Mac  Disk Repair, Mac Directory ...
    Any of the free or low priced utilities that you might see or try will not be able to retrieve a deleted file from a Time Capsule.
    If any backups have occured since you deleted the file, the deleted file has almost certainly been overwritten. No way to retrieve it in that case.

  • How do I get CDs that have been imported into iTunes library to sync/transfer to phone?? very frustrating and any help would be appreciated. all the material i purchased from itunes transferred fine, but CDs won't. Please help!

    How do I get CDs that have been imported into my iTunes library to sync/transfer to my iPhone?? All the material that I purchased from iTunes has transferred just fine, but although the CDs will import to iTunes, they will not sync up with my phone. How do I do this?? I am very frustrated and would greatly appreciate any help.

    In what format did you import the cds?
    I have never had an issue with this.

  • How do I save photos that have been synced to my Ipad2, so that they do not get deleted when I sync with a different photo file on my computer.

    How do I save photos that have been synced to my Ipad2, so that they do not get deleted when I sync with a different photo foder on my computer (Pc win7).

    Place that first folder of photos that you synced to the iPad within the main folder of photos that you sync from and select them to sync again. You can place any number of subfolders within the main folder that you sync from and select those folders to sync. Just "tick"(select) the folders in the photos tab in iTunes.
    iOS and iPod: Syncing photos using iTunes

  • HT4995 How to find iphone 4s, that was stolen?

    How to find iphone 4s, that was stolen? Is it real to see location of it?

    You can see its location if all of the following are true:
    - You enabled Find my iPhone on the phone before it disappeared
    - You set up an iCloud account
    - The thief did not turn the phone off, remove the SIM, restore the phone or wrap it in aluminum foil
    - The phone has cellular data coverage
    If you enabled Find my iPhone just log in to iCloud and click the Find my iPhone icon.

  • How do I combine files that have already been combined

    How do I combine files that have already been combined?

    Hi Oldshep1959
    I didn't get you ...Please Explain your workflow ...

  • How can I restore photos that have a broken red symbol below them ? Thanks.

    Help!  How do I restore photos that have a broken red symbol below them? Thanks.

    Can you post a screenshot.

  • How do I access files that have been recovered (after a Mavericks problem) with the .cca file extension

    How do I access files that have been recovered (after a Mavericks problem) with the .cca file extension

    First, to access documents you must use an app designed for that specific Document type. So Pages will not be able to open PDFs. The Documents app by Readdle can handle PDFs though. In the latter case, you'd open the app, click the menu icon at its top left, and click Open to go to your iCloud Drive. With Pages, if you had files outside the main Pages folder, click + then iCloud and navigate to the file's location.
    Matt

  • How to find form descriptor, that attribute is a collection

    Hi, simple question. How to find form descriptor, that attribute is a collection?
    I got a class name and attribute name (java attribute name not the name of a column in db). I need to decide if attribute is a collection = many_to_many/one_to_many mapping. I can use a reflection but I find using Toplink metadata better, because I need this information for qenerating Toplink query.
    This is how I can get mapping for attribute. How to continue? Is it a flag or what?
    Descriptor d = serverSession.getDescriptor(MyClazz.class);
    DatabaseMapping m = d.getMappingForAttributeName("attributeName");
    Thanks
    Fero

    I found this solution:
    Descriptor d = serverSession.getDescriptor(MyClazz.class);
    DatabaseMapping m = d.getMappingForAttributeName("attributeName");
    boolean isCollection = m instanceof OneToManyMapping || m instanceof ManyToManyMapping;
    Is it OK? Or is there something better?

  • OS X Server Wikis - How do i delete people that have left the office?

    OS X Server Wikis - How do i delete people that have left the office?
    Some people participated in the editing of the wiki and they have now left the office. How do i remove them and their documents from the People page?
    Thank you.

    Should be able to do so from the Users pane (select the user then click the "-" below the list of users. That worked for me with all but one out of five users I deleted. No matter what, their Wiki person page remained, so I hid it from view.
    Sorry I couldn't provide more conclusive help.

  • How to find the TCODE that is created for the table maintanance generator

    Hi ,
    How to find the TCODE that is created for the table maintanance generator of particular table,if we only know the table name.
    Regards
    Ramakrishna L

    Hello,
    I try it this way
    1. Goto SE16 --> enter table TSTCP.
    2. In the selection-screen displayed, enter
    PARAM = *<ZTABNAME>*
    You will get the t-code for the TMG.
    BR,
    Suhas
    PS: Are you sure a t-code has been created for this TMG ?

Maybe you are looking for

  • Stage3D and a Mid-2010 MacBook Pro

    So, I have a Mid-2010 MacBook Pro running Lion. It has a GeForce GT 330M. According to everything I can find online, my computer should support Stage3D. However, when I try and use an application that calls for it, I get errors about an unsupported g

  • How can I search a word in a column and erase all the rows containing that word?

    How can I erase all the rows containing a certain word at once? Right now I do it manually : I search the word in a certain column with cmd+f, after that it points out where the word is in different rows. And then I manually erase every row but this

  • How can i Refresh my Variable Screen In WAD templet?

    Hi Experts, When i execute a WEB Templet giving Variable Selection Inputs , the Variable input values gets stored in the Variable Tab and will not change untill i Change it. Example Variable input 0PLANT     5030(this 5030 is the input where i give i

  • OK, I THINK I HAVE FOUND THE FIX TO RESTORE CONTACTS, CALENDAR ETC

    Try this.......takes about 2 mins 1. In itunes, top left click edit 2. when it opens click preference 3. when it opens click devices 4. this shows all your back ups 5. select the back up you want. 6. close that window 7. go to your iphone symbol on l

  • HELP! I want to Get RID Of this THING :(

    Hi! Please HELP! I have Adobe Photoshop CC 14.1.2 And i want to know how to get rid of this thing.... When ever i move any layer it shows me this (Marked in RED) Its too annoying already know how much i am moving still shows me the static of movement