Window closing error

i written a java program for swing form. the form having default window close button. if i click on close button i displayed a dialog contained Yes-No-Calcel . if i click on cancel it will be exit. How can i stop the window closing.

Look at this codes:
import java.awt.event.*;
import javax.swing.*;
public class ClosingFrame extends JFrame {
     public ClosingFrame() {
          super("Closing frame");
          setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
          addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                    int res = JOptionPane.showConfirmDialog(ClosingFrame.this, "Do you want to quit?", "Exit", JOptionPane.YES_NO_OPTION);
                    if (res == JOptionPane.YES_OPTION) {
                         System.out.println("Bye");
                         System.exit(0);
                    else {
                         System.out.println("So you stay!");
          setSize(200,200);
          setLocationRelativeTo(null);
          setVisible(true);
     public static void main(String[] args) {
          new ClosingFrame();
}Denis

Similar Messages

  • My Macbook Pro makes the Windows Critical Error sound randomly.

    So recently my MacBook Pro 17" Late 2011 has been making the Windows critical error sound just out of the blue. It even happens when the sound is off or the lid is closed. I do not have a windows program open but i do have VMWare and Windows installed on it but it happens even with the program closed down. Has anyone ever heard of this happening?

    bump

  • Why do I keep getting the windows messenger error even after disabling it?

    Hi,
         I am trying to download the flash player 10 on my windows XP computer. I get the error(s) close "Internet Explorer" and close "Windows messenger" during download. I closed Internet Explorer ok, but still keep getting the Windows messenger error even after stopping it and disabling it. I also have IT on medium and firewall and antivirus disabled.
       How do I fix this problem. Please help. I need a flash player for work...Thanks
    Nitrowizard88

    ok, Here is whats listed
    flash10l.oxc active x control
    flashinstall, log
    flashutil10l_activex.dll
    flashutil10l_activex.exe
    genuist.exe
    kb923789.inf
    install.log
    I think I am running IE7
    32 bit..not sure on this...

  • Fit Image CS4: Error: Unable to create Window - OS error [1400]:210

    Hi there,
    I'm running Vista Ultimate 64 bit Photoshop CS4 Extended and have come across a problem with the Automate/Fit Image script. I have read the other posts here concerning a bug in the script, but I'm not even getting to the stage of the script giving me any options to run - I just get the following in a Script Alert message box: Fit Image CS4: Error: Unable to create Window - OS error [1400]:210
    I can see that the script is in the Presets/Scripts directory OK. Anyone with any ideas please?

    Thanks for that reply. I tried this again and it's working now. The only thing I can think of is that I have closed and opened Photoshop a number of times since having the problem and that may have fixed it.
    I find that if I am doing a lot of work in quick mask mode on large images with the pen tool, after a while, Photoshop starts to develop a very significant lag time, taking a number of seconds to draw the next point or respond to the tool (I'm on Vista 64 bit with 12 GBs of RAM, so it shouldn't be RAM, GeForce 8800 GTS video card 640MB dedicated video memory). I find that I have to frequently close Photoshop to get the tool response time back to normal. Perhaps the inability to draw a dialog box was somehow linked with this kind of problem....

  • I cannot update my ipad2 to ios5.  Updating through iTunes on pc Windows Vista, Error message reads "cannot connect to iPad Software Update Server.  Tried resetting network settings, still not connecting.  Tried updating iTunes, still not connecting.

    I cannot update my ipad2 to ios5.  Updating through iTunes on pc Windows Vista, Error message reads "cannot connect to iPad Software Update Server.  Tried resetting network settings, still not connecting.  Tried updating iTunes, still not connecting.

    Look at iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    Additional things to try.
    Try this first. Turn Off your iPad. Then turn Off (disconnect power cord) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    Change the channel on your wireless router. Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    If none of the above suggestions work, look at this link.
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
     Cheers, Tom

  • How do I correct a Windows Vista error for HP Officejet 6500 E709n wireless?

    I continue to get a Windows Vista error when trying to install the printer software ...now it does print, but only the bottom half of a page..???

    Dave, I would recommend completely uninstalling the printer from Programs and Features (after unplugging the USB cord if you are using one), and removing the printer from both Device Manager and Devices and Printer.
    We are going to reinstall the printer from one of the downloads that HP makes available, but first I will have to know if your printer is the 6500A or the 6500. Also is your Win Vista machine running 64bit software or 32bit software?
    If you can give me a complete product name and the information on your system, I will link you to the appropriate download.
    Let me know!

  • My iTunes wont update, and I can't connect my new iPhone if it doesn't update. It says error when I try to update, and I cant download it because of a "Windows Installer" error...

    I just not a new iPhone and in order to sync it I need the newest iTunes, but I can't update it! I tried checking for updates and then trying to downlaod it. I get this error: "Errors occured while installing the updates. If the problem persists, chose Tools > Download Only and try installing manually."
    Where on earth is Tools anyway?
    When I tried just reinstalling all of iTunes, I had a Windows Installer error...I don't even know what that is!

    tools is at the top of the apple updater but dont get your hopes up

  • Cannot delete file - tried everything - file in use by Windows Explorer error

    Hi - I have tried now for 2-3 hours trying to delete an .mkv file from my "Downloads" folder
    It says the file is in use by Windows Explorer and cannot be deleted
    I have tried deleting it using Del command prompt as me and as Administrator (I am the Admnistrator, there are no other users) - no luck
    I have tried Safe Boot and then deleting - no luck
    I have tried rebooting many times and then deleting - no luck
    Any ideas? It's driving me nuts

    hi to all who have this bug- "file in use by Windows Explorer error"
    this is the only way that it works:
    1.type cmd in search box
    2.go to the drive and the directory the file is in ,for example:
    after you type cmd you have a black screen with c:\user\
    type in the drive the file is in and hit enter example - d: than hit enter
    than you should see d:\>
    now click the directory the problem file is in ,for example i will call the directory "movies"  type in this-   cd movies
    now you will see this d:\movies>
    to delete the file type this:  del filename.mkv (dont forget the .mkv or any other file extension) don't hit enter yet, first open task manager (cntrl+shift+esc) go to process tab than right click on explorer.exe choose and click on end process
    now your desktop should disappear. get back to the "cmd" window and hit enter.
    now the file is deleted. now go back to the task manager and click on "file" on the upper left corner then on new task then type in "explorer.exe"
    and you are done
    please note that the file name you choose to delete cant be with spaces between the letters .if so you will need to change it in the same way in the cmd window only the comand will be instead of "del filename.mkv"(for example) after you are in the
    right drive and directory:
    rename "test space.mkv" testspace.mkv
    hope i helped
    this is the only way it workes
    Instead of running a CMD prompt and typing everything, just start up Winrar or Winzip, kill Explorer, then delete problem MKV files to your hearts content within Winrar or Winzip.
    Winrar and Winzip will navigate your folders as well.
    After you are done, create a new Explorer task.
    or.....   if you need to rename MKV files, just rename them within Winrar/Winzip with Explorer not running.
    I change the MKV extension to AVI (in Winrar with Explorer killed) in order to avoid Explorer issues, if I ever want to move the files in the future without needing to kill Explorer all the time to do so .
    Using WinRAR works for me. Using the cmd function becomes complicated when I cannot rename my file with the rename command".

  • How to tell embedded jinitator applet is still running when window closed

    Hello, we are trying to accomplish the same thing that is mentioned in this post from Metalink. I've searched for a solution and hope someone here can help. Instead of restating the issue I think David Wilson does a good job of explaining what is needed. Can anyone please suggest a possible solution?
    From: David Wilton 07-Oct-05 01:08
    Subject: How to tell embedded jinitator applet is still running when window closed
    How to tell embedded jinitator applet is still running when window closed
    Hi,
    We run an oracle 10g forms application through 9iAS over an intranet. All users are running windows 2000 professional.
    We run separate frame = true but I would like to switch to separate frame = false
    With separate frame = true if the user clicks the outer windows "X" close button (forms mdi window) the user is prompted to save changes before the application ends.
    BUT
    when using separate frame = false
    If the user clicks the upper window "X" button (no longer form mdi window but regular browser window) the window and application is abruptly closed.
    I'm interested in using a onbeforeunload function to confirm if the user wants to close the window. This would be placed in the basejini.htm file. This could always ask if the user wants to exit or not. If they click OK then the window closes but if they click "Cancel" you are returned to the forms application exactly where you left. something like event.returnvalue="do you really want to exit?";
    However if the user exited using the normal exit form method then the applet is already closed before the onbeforeunoad event fires and there is nothing to go back to and I want the window to close automatically. This is accomplished using close.html file in post forms trigger.
    So what I want and what I think many may also want is the check if the embedded applet is still running and if so prompt the user to return to the application or continue to close. Of course If the applet is no longer running then just close because there is no reason confirm closing anymore.
    Does anyone have a html/JavaScript solution that can be placed in the jinitiator.htm file? or similar?
    Thank you
    David
    [email protected]
    From: Andrew Lenton 07-Oct-05 08:58
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I don't know if this is exactly what you are after but you can add the following to the top of your basejini.htm file and it should prompt the user before exiting the IE window.
    <BODY %HTMLbodyAttrs%>
    %HTMLbeforeForm%
    <SCRIPT>
    <!--
    window.onbeforeunload = unloadApplet;
    function unloadApplet(){
    message = "Warning! Please exit the Java Applet prior to
    exiting the browser"
    return message;
    //-->
    </SCRIPT>
    From: Oracle, mohammed pasha 07-Oct-05 09:55
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    David,
    Well I could not understand your complete requirement.
    Refer to Note.201481.1 How to Close the Browser Window When Closing Forms And How to Simulate SeparateFrame By Javascript
    Note.115905.1 How to Close Browser Window When Closing Webforms Applet
    Kind Regards,
    Anwar
    From: David Wilton 07-Oct-05 14:37
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Thank you for your reply and yes you did not understand my question fully.
    Sorry if this is a long reply
    I am able to close the browser window using information in notes 115905.1 and 201481.1, this is not the issue. We implemented this several years ago. It is workable for both separate frame = true or false.
    It is most important to not allow the user to end their forms application by closing the windows browser, they must close using normal form exit commands.
    What I want is to have separate frame = false, the big drawback to this option is the user can exit the application and bypass all forms code by pressing the windows "X" close button. This is why we need the code as just provided by Andrew Lenton above in this thread.
    BUT Andrew's code will always prompt the user before closing the window and I do not want that. I want the user to be prompted only under scenario 2 listed below.
    Here's the 2 case scenario for exiting the application.
    1. If the user closes properly and uses exit form which fires all normal form triggers including post_form with it's call to close.html file.
    All uncommitted changes are saved or rollback and the users session is ended normally both on the database and in the application server.
    All browser windows will close, great all is good. And without Andrew's code the window will close but with Andrew's code the user will be prompted to close or not, if they select Cancel the window will remain but the applet has already ended so why prompt? ...This is what I want to avoid.
    2. In the forms app. if the user clicks the windows "X" close button with uncommitted changes. The browser just closes the changes are rollback without prompting the user to save. The users sessions are now lost and still running in the database and application server until they are timed out.
    If I use Andrew's code then the user will be prompted to continue to close or go back, if they click Cancel to go back then focus returns to the forms application and the user can continue to work. If the user clicks OK then the window closes and unfortunately their sessions are still lost until timed out.
    So what I desire is to add to Andrew's code to check if the embedded applet is still running and prompt the user to close or not accordingly.
    Something like:
    Basejini.htm like
    </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function maximizeWindow()
    window.moveTo(0,0);
    window.resizeTo(screen.availWidth,screen.availHeight);
    function confirm(){
    If(document.embeddedapplet.closed())
    Win.opener = self;
    win.close();
    Else if
    event.returnValue = "Closing Forms Application. OK to continue?";
    </SCRIPT>
    <BODY %HTMLbodyAttrs%, onload="maximizeWindow()", onbeforeunload="confirm()">
    %HTMLbeforeForm%
    I hope this explains my requirements.
    David
    From: Oracle, Evelene Raechel 10-Oct-05 06:45
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Hi,
    Note.199928.1 How to Alert User on Closing Client's Browser Window in Webforms
    Regards,
    Rachel
    From: David Wilton 11-Oct-05 17:40
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I'm sorry this is not helpful at all.
    Note 199928.1 is only an alert which does not stop the closing of the window and still displays as an alert if the user does close properly using exit form ... so why would you want to display the alert then?
    This is exaclty what I do not want and why I want to determine if the applet is still running before displaying any kind of message.
    David
    From: Oracle, Evelene Raechel 17-Oct-05 12:23
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Closing thread.
    Thanks,

    Hello,
    I had the same issue last year - wanting to provide a warning on closing the browser, but only if the Forms session is still running. The approach I took is described below, see also the thread where I originally posted this at Closing brower window
    Hi there,I've had a similar requirement - or rather, the two conflicting requirements: to warn when the browser is being closed, but for the app to be able to close the browser without a warning being fired.
    To always provide a warning when someone (the user or the Forms app) tries to go to a different page (e.g. your close.htm), use Javascript like:
    function confirmExit(){
    if(appletRunning==true) {
    msg="Closing this window or navigating to another page will end your SomeGreatApp session.";
    window.event.returnValue=msg;
    And make a call to confirmExit() in the onBeforeUnload event of your main page.
    You'll notice I first check an 'appletRunning' variable before displaying the warning. This Javascript variable is set to true by my app when it starts up, using an embedded Javabean that calls out to Javascript. Once that variable is set to true, then the warning will be displayed if the user tries to shut the browser by clicking on the 'x' button, or to go to a different URL.
    When my app is shutting down, it uses the same Javabean to set appletRunning back to false. It then navigates to a close.htm - which will be done without a warning being displayed.
    See Re: How can a Javabean call Javascript function of the basejpi.html?? for example code on how to call Javascript from a bean embedded in your Forms app.
    Hope these ideas help you out, it's worked for me (so far, anyway!!)
    James

  • Creative Webcam Vista, Windows 98, Msn 7.0 and windows protection error

    Hi I wondered if you could help me.
    Im running Windows 98 and have a creative webcam installed. i connect it and it works fine in creative webcam monitor. but when in msn messenger 7.0 i click tools-----> webcam settings the computer then freezes up then after a few minutes the screen goes black with "Windows Protection Error Please Restart Your Computer" comes up.
    I'm also running
    McAfee Internet Security 7
    Spybot
    Ad-aware
    Spywareguard
    A-squared
    Spywareblaster
    Ive also tried running defrag and scandisk to no avail.
    Thanks.

    Can you stop the service manually? I would suggest stopping the service, setting it Manual or Disabled, rebooting, and then run the uninstaller again. Hopefully you won't have to resort to uninstalling the service manually.

  • Stream closed error while testing a composite in EM

    HI,
    I have deployed a simple composite and wanted to test it in EM. I am getting a stream closed popup, not sure whats wrong?
    I have restarted the server and problem still persists.

    its actually remote server, I am able to deploy a simple HelloWorld composite and even able to see the same in Em.I can even browse through all the composites deployed there by many other people.But problem is when I try to test it its giving the Stream closed error.
    Is it something to do with access permissions, if so i would not have deployed it in first case..
    the pop up error message----
    Stream Closed
    For more information, please see the server's error log for
    an entry beginning with: Server Esception beginning with PPR, #14
    _______________________________

  • ITunes stopped working on Windows 7, 64 bit. Uninstalled and attempted to reinstall. Windows installer error....iTunes. 10.6.3.25

    iTunes stopped working on Windows 7, 64 bit. Uninstalled and attempted to reinstall. Windows installer error....iTunes. 10.6.3.25.
    Downloaded latest version onto desktop. Will not complete install.

    Many thanks.
    Let's try the following user tip with that one:
    "There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows

  • Problem with syncing iPod ... Itunes and windows show errors... itunes 7...

    hey guys... since I upgraded to itunes7 my ipod (4th gen click wheel) doesnt sync poperly! it all began when I was syncing the ipod and my screen just froze a few secs after connecing the ipod! I had to restart the computer and reset my ipod... from that time had alot of trouble!
    first the screen froze immediately when I connected my ipod with the pc and later when i had formatted it with windows several times and resetted it a million times with itunes7, itunes and windows show errors (error (-124) while syncing and everything stops! I've just spent nearly two nights on that and really hope that my ipod didn't break just because of itunes7! to stay in proper english and not get that angry in letters that I am in mind--- please so help me... my ipod is everything and im a music junkey! by the way... itunes itself works perfectly... if i not sync! how peculiar that getting back to itunes6 is impossible...i tried it... does it hav a spec reason, hah!
    IBM, Pentium3 (666MHZ), FW(desire to fire), Ipod Click Wheel   Windows XP   30cm

    I tried formatting the ipod with windows! in the end of it windows says that it was not able to format the drive properly. then I click ok, open itunes, restore the ipod, try to sync again and have the problem that after a while the whole thing freezes... no more errors....just from the moment i disconnect the ipod manually from the cable, everything gets back to normal life again! I do not know what to do! do you guys think, my computer is too old or maybe my ipod's broke???
    I'm despairing people...never had problems like that until itunes7! I tried as well to close all the other working programs with the task manager... doesn't change it!
    Thx for the help!
    Christopher
    IBM, Pentium3, FW(desire to fire?)...doesn't really matter Windows XP

  • I get the following error message when trying to download ITunes on my computer running Windows XP - Error writing to file: C:\Program Files\Common Files\Apple Application Support\CFNetwork.dll

    I get the following error message when trying to download ITunes on my computer running Windows XP - Error writing to file: C:\Program Files\Common Files\Apple Application Support\CFNetwork.dll

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    The further information area has direct links to the current and recent builds in case you have problems downloading, need to revert to an older version or want to try the iTunes for Windows (64-bit - for older video cards) release as a workaround for installation or performance issues, or compatibility with QuickTime or third party software.
    Your library should be unaffected by these steps but there also links to backup and recovery advice should it be needed.
    tt2

  • Can't get the latest itunes update to download on my windows7 laptop. It gives runtime error window then error 7, windows error 114, any ideas

    First thing to say is I'm new at trying to slove my own computer issues, so I may be a little slow. The latest iTunes update will not install on my Windows 7 labtop,   I keep getting a runtime error window with Error 7 and Windows eror 1114. I have run a fix and reload the file with no resuts and can't seem to get it do download manually either, any ideas for this computer challanged person?

    See... Unable to install or open > http://support.apple.com/kb/TS5376
    Also See this User Tip by turingtest2
    https://discussions.apple.com/docs/DOC-6562

Maybe you are looking for

  • How do I improve performance with exchange

    My corporate email is on an exchange 2010 server. Mail.app works with the server but there are a number of performance problems when sending and receiving, which are also well documented in other discussion threads. I have tried every suggested confi

  • Error deploy Jboss and Weblogic with JDev 10.1.3.0.3 EA

    Hi, I'm having problem with deploy application make with JDev 10.1.3.0.3 EA in a Jboss 4.0.2 and Weblogic 8.1. Very simple app with JSF. The error seems to be in application.xml. Maybe because xml schema. It is a bug? Are there a workround? Thanks! T

  • Itune and quicktime updates

    I still have itune 7.4.. it works just fine why should i update, It seems to me apple is catering to vista. Which is the worst thing ever put on the market. All these recent updates are fouling up my computer. there was a post in here that said apple

  • Error code updating Adobe Application Manager

    How do I get Adobe Application Manager to update, it either fails or I get Error code A12E1

  • Application very slow to installing on macbook pro , why?

    application very slow to installing on macbook pro , why?