My windows won't close

Hi. I registered a listener with my window, but when I press the X button, there is no response. What did I do wrong?
import java.awt.*;
import java.awt.event.*;
public class App0000
     public static void main(String args[])
          Frame frm = new AppWindow();
          frm.setVisible(true);
class AppWindow extends Frame
     public AppWindow()
          this.setSize(600, 400);
          this.addWindowListener(new WindowTerminator(this));
class WindowTerminator extends WindowAdapter
     private Frame theFrame;
     public WindowTerminator(Frame f)
          this.theFrame = f;
     public void WindowClosing(WindowEvent e)
          this.theFrame.dispose();
          System.exit(0);
}

You created a class that extends WindowAdapter. If you look at the API docs for WindowAdapter, you will see that there is no existing method named WindowClosing. There is a method named windowClosing, however. Since Java sees these as 2 different methods, you have added a method to WindowAdapter instead of overriding a method. So when a WindowEvent occurs, the WindowAdapter method named windowClosing is called, which does nothing.

Similar Messages

  • Windows won't close; app won't exit

    Hi,
    After some system admin (on Solaris 2.7) my Swing GUI application won't terminate and the main window won't
    close. My code in my main window is:
    addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    I have to do 'ps' and 'kill -9 <pid>'. The same behavior occurs w/ the Swing Java tutorial apps; e.g.,
    I only added a System.out.println("Window closing event captured") in the ListDemo.java src. WHen I close the
    main window, I see this string displayed but the window
    doesn't close (or it starts to, goes blank) and the app
    doesn't exit.
    I'm fairly certain it's an environmental problem, but
    am stuck as to what to investigate. If anyone has
    seen this behavior and could shed some light, I'd be
    appreciative...
    Thanks,
    Marcia

    I tried doing this: In the tutorial's ListDemo.java src, I replaced the entire WindowAdapter() code block with one line:
         frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
    This didn't help (w/ either JDK 1.4.0 or JDK 1.4.1, on
    Solaris). The app still doesn't terminate. The xterm from which I launched the app isn't responding to control-C. I have to kill the xterm. Also, if I can't write a WindowAdapter, how can I do some other stuff
    (like closing network connections, etc.) before exiting?
    Thanks for the help; any further suggestions would be welcome.

  • Windows won't close, lockups, drop down menu bar not working - IE works fine - what's going on with firefox?

    Just bad performance from firefox the past couple of weeks
    I down loaded a fresh version of firefox, but it didn't help
    see above question
    Lockups, windows won't close, drop down menus not working
    Internet Explorer works fine

    http://support.mozilla.com/kb/Basic+Troubleshooting

  • Windows won't close

    I installed Safari Beta 3 and now Windows won't close just the tabs will.
    Any body else have this problem?
    iMac G5 1.8 GHz Superdrive   Mac OS X (10.4.10)  

    Hi
    "Repair permissions" using Disk Utility in your Utilities folder. Restart Safari. If that doesn't help, uninstall/reinstall Safari using the uninstaller and install items in the Installation package. Restart Safari etc.
    Post back

  • Several tabs in a window won't close.

    I've tried command-W, clicking on the X, and using the menu to close them, and two of my open tabs won't close at all.

    Try temporarily disabling JavaScript. In the Tools menu select Option, then go to the Content panel in the Options window and de-select the setting "Enable JavaScript". Close the Options window and then try to close the tab. You can then re-enable JavaScript.

  • Blank finder window won't close

    When I click on the finder, a blank window always appears first. This window contains nothing and won't close. If I open a new finder window everything works fine operating like a normal finder window with all the choices. What gives?

    Then, your com.apple.finder.plist file's mucked up, because with no Finder windows opened, clicking on the Finder's Dock icon should follow whatever you set in Finder's preferences->General. Move it out of your /Library/Preferences/ to the Desktop, OPTION-click & hold the Finder's Dock icon, select Relaunch, select Finder's Preferences->General->set an open option, close the window, and click on the Finder's Dock icon. Note that you'll have to reset all of Finder's preferences if this fixes things, ultimately deleting the moved plist file.

  • Windows won't close when you quit Pages '09

    Anybody else find that the Special Character and Help Pages windows don't close when you quit Pages? Also, these windows can't be relegated to the background when clicking on an underlying page. These seem to be really sloppy oversights...

    I appreciate that the Character palette and Help are separate applications. The problem is that there is no need to keep these windows open once the program that called them is closed. Moreover, when Help is called in Pages '09, the window that is left open after the program quits is Pages '09-specific. You can't use it to submit queries for help with any other applications. Therefore, there is absolutely no sense in keeping it open. I kind of equate this to a messy kid that doesn't clean up his/her toys once (s)he's finished playing...

  • Mail 2.0.7 preference window won't close

    If I go into the prefs window to edit whatever, I hit the close button and nothing happens. The window will not close. I have to quit the entire application to close. Note I have plugins installed - Iconizer, Mailtags and Act-on. Anyone have similar issues? If so, any resolution?
    Mini   Mac OS X (10.4.5)  

    try this one:
    http://discussions.apple.com/thread.jspa?messageID=1929117&#1929117

  • Since updating Safari windows won't close

    I updated to 10.4.11 on my G5 and now whenever I open a window in Safari, I can't close it. I tried apple-w ... nothing. I tried clicking the red button in the top left corner of the window ...nothing (although the green and yellow buttons still work fine).
    Anyone else having this problem?

    A lot of people who had installed Taboo (a safari plug in that gives a warning when closing a window with multiple tabs open) have been having this problem.
    This causes a conflict with Safari 3 and won't allow you to close windows. All you have to do is remove Library/Application Support/SIMBL/Plugins/Taboo!!
    Fortunately the warning feature is included in Safari 3, making Taboo redundant.
    Taboo worked so seamlessly that I had completely forgotten that I had it installed!!! If you are not sure, check the location above to see if the bundle is there and delete it if it is.
    hope it helps

  • HT4847 can't open preferences because iCloud window won't close

    hi , im new to macs , very new , and im trying to open my preferences but when i do , i get a window with icloud , that wont close , it just shows the orange light , no green , no red , just orange . and when i do press the orange option it just puts it into stack , then i try to open preferences again and instantly the icoud window appears and wont let me cose , its even got the box with ' done ' to click , but nothing happens when i click the done box , im frustrated because i cant do nothing to my references because of this icloud window that wont quit , even open icloud and tried to quit but it wont because of this window.thankyou beforehand for any help ,im new and desparate thankyou john.

    Rick,
    The documents aren't replacing each other - what you're experiencing is the new "tabbed windows" feature in CS4. Next time you try to open 2 documents, look at the bottom of the "Window" menu and you'll see that both documents are actually open. Then look at the window's title bar and you'll see two "tabs", similar to what some web browsers do with multiple open windows. Just click on the tab of the window you want in the foreground.
    If you'd prefer to go back to the CS3 method, go to "Preferences>Interface" and un-check the "open documents as tabs" checkbox.

  • Preferences window won't close in Mail 2.0.7

    I've been annoyed that any time I open the Preferences window in Mail (to change account settings, rules, or whatever), it will not close. It doesn't respond to the close box being clicked, nor the Close Window command. I'm using OS X 10.4.6 on a DP2.0 G5. I'm sure that the solution is to just delete one of the plist files, but I don't want to delete the wrong one because that could mess up my settings. Anyone know what the fix is for this problem?

    Hi
    If you have MailTags 1.2 installed, there was an issue that prevented the pref window from closing. You should update MailTag 1.2 to 1.2.1 to resolve this and several other issues in 1.2
    MailTags can be found at http://www.indev.ca/MailTags.html
    Scott
    (developer of MailTags)

  • Java Script Debugger window won't close.

    Due to a random combination of keystrokes, Java Script Debugger loaded up while I was doing something else.
    I don't use JSD and didn't even know what it was until I Googled it.
    I don't want the JSD window taking up space on my desktop, but clicking on the red button does nothing. The green button just shrinks/enlarges the window.

    i just ran your code and it closes fine for me (using jdk1.4b65). more code might be helpful... have you added a WindowListener or anything else that might be interfering with the default close operation?
    You might also want to think about grabbing a new JDK. It is not unheard of for bugs, even ones as severe as this one, to sneak into certain releases.

  • HELP! Finder windows won't close.

    I hit the "Apple O" (Open ALL) shortcut on a wrong window and now it has opened all 300 folders with music in them in the finers. It's too much for the computer, so it is stalling.
    I cannot hit the x to close any window. I cannot highlight all and close all.
    Any other ideas?
    Basically, I need to do the "control-alt-delete" like you can do on IBM, but I don't know how to do this with mac.
    Any ideas??

    Press the Option, Command, and Escape keys simultaneously, or press the Option and Control keys when clicking on the Finder in the Dock; in either case, relaunch the Finder.
    (27117)

  • HELP! Windows won't close.

    I hit the "Apple O" (Open ALL) shortcut on a wrong window and now it has opened all 300 folders with music in them in the finers. It's too much for the computer, so it is stalling.
    I cannot hit the x to close any window. I cannot highlight all and close all.
    Any other ideas?
    Basically, I need to do the "control-alt-delete" like you can do on IBM, but I don't know how to do this with mac.
    Any ideas??

    Apple Discussions!
    Somehow you reached the wrong forum area. This area is for OS 9.x issues.
    Since your system info confirms you are using Panther, you will need to repost over in the Mac OS X v10.3 & earlier Forums

  • Acrobat windows won't close

    Hi,
    Sorry if this is the wrong forum, but I couldn't find a general troubleshooting for Acrobat forum.
    I've got Acrobat Pro XI and for some reason I can't get the windows to close when I press the red x. I end up having to quit the entire program. Has anyone had this problem and knows how to fix it?

    I generally just wait a bit and it closes.

  • Tabbed windows won't close!  Click on close box, stays open! Any solutions?

    Frequently in Safari 3.1.2, when I click on the close tab circle, the tab doesn't close! It may not even close after several tires. Command-w is what I resort to, but it's irritating that mouse clicks don't their biz. After a few tries, it often restores itself, or other tabs work fine.
    Anyone else experience this? It's not a matter of missing the close circle as I can watch the mouse pointer click dead center!

    A follow up on this. I've discovered that the close action turns off entirely! To bring it back on line, I click on a different tabbed window, then return, and the close circle box is active again.
    What gives?
    Can anyone reproduce this? Anyone else experienced it?

Maybe you are looking for