Want my JFrame to be the *only* one that can end the program when closed

Hi all,
I have an application that is essentially a launcher for other applications -- it's a holder to allow us to demo our work and other Java examples (not necessarily our work). The launcher will either run methods to launch an application or will find a class's main method and invoke that.
In all cases, the other applications open up their own JFrames, separate from my launcher (this is a good thing). The problem is that, in general, the other JFrames are set to EXIT_ON_CLOSE. This means that if the user closes the second window, everything will close.
Is there anyway to prevent this from happening? I'd like either a way to say that my JFrame is the only one that can exit the program when closed, or to say globally that JFrames can't exit on close, and then re-work my initial frame so that it is still able to exit.
Note that changing all the other applications so that they do not include the EXIT_ON_CLOSE line is not an option (several of the applications we have the right to use, but not the right to modify, for instance).
Any thoughts?
Thanks,
Sam

Darryl.Burke wrote:
I have a similar launcher application and this is how I tackled the issue....
Window[] windows = Window.getWindows();
This seems like a great work-around. The only problem is that Window.getWindows() is only 6.0, and unfortunately I can only assume 5.0. I can't see another method in the Window class that will return unowned windows -- is there another method that you know of?
Edit: I found I can use Frame.getFrames() instead, but unfortunately I've discovered this doesn't solve my problem. One of the applications is listening to window closing and is calling System.exit(0) itself, and is not using EXIT_ON_CLOSE as I previously thought. So I think that launching a new JVM may be the only option.... Any advice on how to do this? I'm a little stuck with the ProcessBuilder stuff above.
>
edit In future (not this time), Swing related questions should be posted in the [Swing forum|http://forums.sun.com/forum.jspa?forumID=57]
I guess I was thinking this as a process-oriented question (I had already been thinking of the "different JVM" tactic), but the other option was to think of it as a pure-swing problem, like your solution above. Guess I should have just cross-posted -- everyone loves that! ;-)
Edited by: Asbestos on Dec 18, 2008 12:32 PM

Similar Messages

  • Am I the only one that can't see anything on the download page...

    to download itunes 7? I just see the page but nothing to click on. Has it been taken down because of problems?
    Thank you

    The inimitable b noir has reported that one cause of this problem relates to the Norton Internet Security Suite.
    for a moment there i thought i had been whisked back in time to the itunes 4.9/5.0.x days, my dear The Mimico Kid.
    ... i'm calling this one "god-daughter of no button syndrome" ...

  • How come my phone will no longer hook up to my work wi-fi?  it has for almost 2 years and all of a sudden it does not.  I am the only one that can not get on.

    My phone is no longer hooking up the my Wi-Fi at work.  I has for almost a year and now all of a sudden it will not.  Everyone can hook up so they did not change anything as far as the Wi-Fi.  It hooks up at my Wi-Fi at home fine and other areas, just at work is the problem.  What could be causing this?  I am using the Motorola Moto Rzr

    Could be your work banned your particular MAC address or some such.  Maybe they ran an analysis on network usage and type of use and found you to be a large consumer on their network.  IDK what type network you are on or business you work at.  I know it's been done before to curtail employee efficiency.  Otherwise, you may need to speak to the administrator of said network.

  • How do you lock the ipad so only one app can be used

    I want to force a student to communicate using an ipad communication app.  I want the only thing on the screen to be that one app.  How do I lock the app so it is the only one that can be used on the ipad?   Is there a way to lock a page?  ie when he has navigated to the correct page to prevent the child from exiting and make him make a choice from that page?
    Thanks!

    You can lock an iPad to a given app via Guided Access:
    http://support.apple.com/kb/HT5509
    To try and lock a web browser to a single page you'll need to investigate third-party browsers such as MobiCIP or the McGruff browser and see if they allow you to lock to a single page. Safari in iOS 6 or earlier has no controls and in iOS 7 allows you to restrict to a given site or set of sites but not to a single web page.
    Regards.

  • HT5100 How to limit the number of downloaded videos in parallel to one.i want my iPad itunesu to download only one video at once at time and when finished from downloading it to pass to the second queued one.

    How to limit the number of downloaded videos in parallel to one.i want my iPad itunesu to download only one video at once at time and when finished from downloading it to pass to the second queued one.

    @Tylerdowner: hmm.. maybe yes.. I just want to use the DOWNTHEMALL AddsOn for the saving file not the default download.. because my costumer download MP3 files and save it 3 or more files at a time so my Internet Connection goes down :( so I just want to limit them to save 1 file at a time.
    or if there is another way to limit it to 1.. please tell me :(

  • I want to be the only one who can access my profile, so how to create passwords for profiles (NOT for websites) ?

    I want to be the only one who can access my profile, so how to create passwords for profiles (NOT for websites) ?
    thanks

    Maybe use the portable Firefox version on a USB stick if you want to prevent access to your profile.<br />
    Solutions that use an extension can easily be bypassed by starting in [[Safe mode]].<br />
    Otherwise you need to locate the Firefox profile folder on an encrypted drive.
    See http://portableapps.com/apps/internet/browsers/portable_firefox

  • Why is 1080i the only one that works for my slideshow.

    Well... I'm getting to my breaking point.
    First my system.. Mac Pro 2.66 2x300gb raid 0. x1900 ACD 30
    5gb Ram
    I have read many many posts.. but I still need your help.
    I have found that the only thing that gives me a marketable slideshow in terms of quality images is to make a slideshow in imovie under 1080i.
    The problem with this is that it really really slows my computer down, and I don't want to do this with a slide show of about 150 images per client, and then have wait more for transistions.
    Shouldn't I start a new slideshow in "DV" setting for a 4x3?
    I have tried reducing res from 10.2 mp to a 1024x??? settting for images (depending on orientation). All I seem to lose here is a bit of sharpening as I reduce the image resolution, which makes sense if I understand correctly.
    So... Where to go from here.
    I read the posts.. and have determined that I can use Photo to move (which I have) to make clips and import them into Imovie. Again, a slow process as each clip has to be done seperatly. Is there another way with PTM, because it does render the best Ken burns effect I have seen. Again 150 images is too long to wait to make a slide show of a wedding, not cost effective for me.
    Hope someone can help.

    Anyone??
    When I make a movie in 1080 or 720.. it takes alot of resources and slows things down.
    Just wondering why choosing those options are the only ones that seem to work
    I really need to get it into 4x3 format too.

  • It seems I cannot use Sky Go even if I use Firefox. The only one that works is IE 11.

    I was using Google Chrome, but it seems they do not support Silverlight which Sky Go use. I was told that Firefox would work. It doesn't. The only one that works is Internet Explorer 11, which is very slooow. Why can't I use Firefox to view Sky Go?

    My Sky homepage. If I want to watch cricket say, it come up with ' sky go unavailable at this present moment'. If I log on to my IE 11, sky go works Ok. I have the Silverlight add-on or plug-in whatever you call it.
    Still no joy in Firefox.

  • Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

    hi all
    i have a table that name is:
    TiketsHeader 
    but i used this code
    SELECT TicketsHeaderId, Active, TH.PersonRef,P.Fname + ' ' + P.Lname AS NF, Serial, TicketsCnt, StartSerial, EndSerial, KindDate, StratDate, EndDate,
    MonthsRef1,(SELECT * FROM dbo.Months M WHERE M.MonthsId= MonthsRef1 ) AS MonthsName1 , MonthsRef2, MonthsRef3, WeekDaysRef,
    PoolTimesRef, TH.Descreption
    FROM dbo.TiketsHeader TH
    INNER JOIN Person P ON P.PersonId= TH.PersonRef
    i see this error:
    Msg 116, Level 16, State 1, Line 2
    Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
    how to solve it
    please help me
    Name of Allah, Most Gracious, Most Merciful and He created the human

    SELECT TicketsHeaderId, Active, TH.PersonRef,P.Fname + ' ' + P.Lname AS NF, Serial, TicketsCnt, StartSerial, EndSerial, KindDate, StratDate, EndDate,
    MonthsRef1,(SELECT * FROM dbo.Months M WHERE M.MonthsId= MonthsRef1 ) AS MonthsName1 , MonthsRef2, MonthsRef3, WeekDaysRef,
    PoolTimesRef, TH.Descreption
    FROM dbo.TiketsHeader TH
    INNER JOIN Person P ON P.PersonId= TH.PersonRef
    A Sub query like this can only return one column, not serveral like here with the star *. Replace the star by one column Name that you want to query.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Just updated my iphone with iOS 7.0.2 and when I call or people call me, only one party can hear the other. Would you know how to fix this problem? Thanks

    just updated my iphone with iOS 7.0.2 and when I call or people call me, only one party can hear the other. Would you know how to fix this problem? Thanks

    Hi Apple_Mom,
    Thanks for visiting Apple Support Communities.
    If you've noticed issues after updating to iOS 7.0.2, you may want to first update to iOS 7.0.3 which was recently released.
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    If the behavior persists, the troubleshooting steps in this article can help:
    iPhone: Can't hear through the receiver or speakers
    http://support.apple.com/kb/TS1630
    Cheers,
    Jeremy

  • Am I the only one that I cannot get ICH5R RAID0?

      I tried every possible BIOS settings to have a RAID0 array on Intel controller,create RAID0 array with control+I, feed the floppy with F6, and every time I get a blue screen before the beginning of XP installation.
      I wonder if I am the only one that I can't get the benefits of ICH5R RAID0 array?
       Same HD's work fine with Promise controller RAID0. :O

    Quote
    Originally posted by Pete M
    kanopus
    This is my BIOS configuration using 2 WD Raptors
    Integrated Peripherals
    ON-CHIP IDE configuration
    ON-CHIP ATA(s) Operate Mode Native Mode
    ATA Configuration S-ATA only
    P-ATA Keep Enabled YES
    P-ATA Channel Select Both
    S-ATA Ports Definition PO-1st/P1-2nd
    Configure S-ATA as RAID Yes
    Not familiar with your drives are there any jumper settings you need to make ?
    Pete
    I have 2 WD Raptors (setup for RAID 0), an ATA100 drive (Primary) and a DVD (Secondary) connected to the Intel controller.
    Is there any performance gain by using your configuration:
    ATA Configuration S-ATA only
    P-ATA Keep Enabled YES
    Versus using:
    ATA Configuration P-ATA and S-ATA
    It seems like the end result is the same.  Both the SATA and ATA100 are enabled.
    I noticed that if you want to use the RAID array as your system drive you need to set S-ATA Ports Definition to use SATA on ports 1 and 2.

  • I have 2 email addresses on the phone. How come only one accepts a alert tone. When I receive an email from 2nd email it does not notify me of its arrival. What am I doing wrong

    I have 2 email addresses on the phone. How come only one accepts a alert tone. When I receive an email from 2nd email it does not notify me of its arrival. What am I doing wrong?

    Each email account can have its own alert or notification settings.
    Settings > Notifications > Mail > tap on each account and set the alerts you want.

  • HT2506 After updating my system to Mountain Lion 10.8.2 I can no longer view videos on Facebook or other sites. The only one I can view videos on is youtube. I have downloaded Adobe Flash player and still no luck. I cannot even open Preview on my computer

    After updating my system to Mountain Lion 10.8.2 I can no longer view videos on Facebook or other sites. The only one I can view videos on is youtube. I have downloaded Adobe Flash player and still no luck. I cannot even open Preview on my computer anymore. Any ideas would be helpful thanks

    Merely clicking the Preview icon in the Dock doesn't cause it to open anything, unless you had one or more windows open the last time it quit.
    If you're sure you've installed the latest version of Flash, take each of the following steps that you haven't already tried. After each step, relaunch Safari and test.
    1. If you're getting a "blocked plug-in" error, triple-click the line below to select it:
    /Library/Internet Plug-Ins Right-click or control-click the highlighted text and select
    Services ▹ Open
    from the contextual menu. A folder should open. If there is more than one item in the folder with the words "Flash Player" (not "flashplayer") in the name, open the respective Info windows, check the version numbers, and delete all except the latest. You may be prompted for your login password. If you get the same error after doing that, re-download and reinstall Flash. Download it from this page:
    Adobe - Install Adobe Flash Player
    Never download a Flash update from anywhere else.
    2. If you get a "missing plug-in" error, select
    Safari ▹ Preferences... ▹ Security
    from the Safari menu bar and check the box marked Enable plug-ins.
    3. Select
    Safari ▹ Preferences... ▹ Extensions
    from the Safari menu bar. If any extensions are installed, disable them.
    4. In the Safari preference window, select
    Privacy ▹ Remove All Website Data
    Close the window. Then select
     ▹ System Preferences… ▹ Flash Player ▹ Advanced
    and click Delete All. Close the preference pane.

  • I have two iTunes accounts, one for music and another for audiobooks.  I want to merge them and maintain only one iTunes account.  How do I do it?

    I have two iTunes accounts, one for music and another for audiobooks.  I want to merge them and maintain only one iTunes account.  How do I do it?

    You cannot.

  • Adobe is giving me the runaround when all i want to do is download the programs i bought several years ago. Anyone else experience this? Contacted support, was told i would get a call back.  Account blocked so I had to create a new one to download trial v

    Adobe is giving me the runaround when all i want to do is download the programs i bought several years ago. Anyone else experience this? Contacted support, was told i would get a call back.  Account blocked so I had to create a new one to download trial versions to compete my work.  So frustrated.

    You will need to have the serial number to activate the products. Please have then handy & also check the compatibility of the operating systems.
    Regards
    Rajshree

Maybe you are looking for