How close the window

I've tried to click the 'X' button in the window but the window frame don't close at all.
here's the code
public class test {
     public static void main(String args[]) {
     Frame frame=new Frame("Red VS Blue");
     frame.setSize(400,200);
     frame.setLayout(new GridLayout(2,0));     
     frame.setVisible(true);
i'll like to know what's going wrong why can't i close the window frame and exit the application.
hope someone can tell me the reason and how to solve it.
thanks in advance

You have now the code.
And the reason is: you have to explicitly register a listener with your frame. And this listener must implement the windowClosing(WindowEvent) method in order to respond to clicking on the 'X' button.
Here you can find some information about the event handling:
http://java.sun.com/docs/books/tutorial/uiswing/overview/event.html
And here is another tuttorial about swing and the MVC pattern:
http://developer.java.sun.com/developer/onlineTraining/Downloads/SwingII.pdf

Similar Messages

  • How can I turn back the suggest option on iTunes when I purchase a song? somehow I close the window and now it doesn't come up

    how can I turn back the suggest option when I purchase a song? somehow I close the window that suggest the song similar to what we purchase on itunes

    NVM!!! Everything is strangely fine now!

  • I downloads the latest iTunes software update and it properly installed.  But,  I cannot close the window showing it was completed and the blue completion bar is full but cannot cancel or close it either.  Any ideas on how to clear that out and close the

    I downloaded the latest iTunes software update and it properly installed.  But,  I cannot close the update window showing it was completed and the blue completion bar is full but cannot cancel or close it either.  Any ideas on how to clear that out and close the window.  Tried to quit on both the big window and the software update title in the menu bar.  No luck.

    Tried that by shutting down via the power button only as the normal shutdown was nixed by the open window issue.  It did not help.  Found a very similar question in the discussions and it recommended "Force Quit".  That worked and the update works normal and the window is gone.  Thanks!

  • How can avoid to close the window?

    My problem is that when user decides to close a window, system should ask conferm to that action, if user responds no, the window should stay, vice versa window should be closed if user conferm closing.
    Ok my code:
    void this_internalFrameClosing(InternalFrameEvent e) {
    int r;
    this.setClosable(false);
    JOptionPane dlg = new JOptionPane();
    r = dlg.showConfirmDialog(this,"Are you sure to quit?","Quit?",dlg.YES_NO_OPTION);
    if (r == dlg.YES_OPTION) {
    this.setClosable(true);
    doesn't work. How can I cancel closing of the window, because window will be closed anyway!

    This will prevent your internal frame from closing:
    frame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
    Then you have to define your closing logic in the internalFrameClosing() method of InternalFrameListener. Be sure to close the window manually using frame.dispose().

  • In FF 3, Intellimouse ("5" buttons) back button closes only the current tab. In FF4 it closes the window. I prefer the former. How can I get FF4 to do that?

    MS's Intellimouse has five "buttons" including the scroll wheel. I set left and right buttons to L-click & R-click (seems normal). I set left side button to Back and right side button to Close.
    In FF3, Close closes the current tab and Ctrl-W closes the window. In FF4, this is reversed -- Close closes the window and all its tabs and Ctrl-W closes the current tab -- not my preferred behavior.
    The behavior switch in FF4 may or may not have been a function of what somebody had for breakfast. It is was, then I'd like it switched back. If there was an important reason for the switch, I'd like to know.
    Until FF4 reverts to FF3 behavior, I'm probably stuck in FF3.
    In anyhow, thanks -- John Linford, Fort Worth

    Harley, thank you so much. I'll reload FF4 and re-set the settings.
    John

  • I have my FireFox browser set to delete the history when I close the window. It was working for a while and has recently just stopped with no changes to the settings.

    I have my FireFox browser set to delete all the history when I close the window. It was working for a very long time and has recently stopped with no changes to the settings. This has happened once before and I deleted FireFox and re-downloaded it, that solved the problem for a short period of time but the issue has come up again. How can I fix this?

    Can you check your configuration again? Maybe something went pear-shaped somewhere. It's located in Tools | Options | Privacy and then click the Settings button (see screenshot).

  • The webpage your are viewing is trying to close the window

    Hi. I run an HTML script which in turn runs my Web Form and quickly closes the initial IE window (for neatness). However, it the user first is prompted:
    "The webpage your are viewing is trying to close the window.
    Do you want to close this window?"
    Do you know what causes this and how I can surpress the message?
    Thanks in advance.

    See Re: HELP - CLOSE WEB BROWSER

  • Get rid of message: "If you close the window, your changes will be lost..."

    Whenever I enter text, then close the window, I get the message, "if you close the window, your changes will be lost. Do you want to close the window anyway?"
    Yes, I do want to close the window, and I want to get rid of this message from popping up. Can't find it anywhere in Safari. Please help me out. Please, how do you configure Safari so this message will not pop up?

    HI David,
    From the Safari Menu Bar, click Safari / Reset Safari. Select the top 5 buttons and click Reset. Relaunch Safari. If you still see that dialog...
    Go to the Safari Menu Bar, click Safari/Preferences. Make note of all the preferences under each tab. Quit Safari. Now go to ~/Library/Preferences and move this file com.apple.safari.plist to the Desktop.
    Relaunch Safari and see if that makes a difference. If not, move the .plist file back to the Preferences folder. If Safari functions as it should, move that .plist file to the Trash.
    Carolyn

  • Close the window (browser after execute business action

    I have ceated a JSP which will trigger a popup. How can I close the popup after executing some business action in the pop.jsf ?
    in addition, since my popup will return value to window.opener, but I have tried that I have a page forward in the popup, it cannot locate the window.opener and hence cannot return value to the opening windows but only return me error 404 page not found.
    actually my popup is just like a searching form, user can input some string to serch the DB and then display the data in datatable. then user can pick up the record he would like to choose and returning a code back to the opening windows...so i want to close the popup, or returning the value to the opening windows if i have a screen refresh in the popup
    Can anyone help in this issue? Many thanks

    Hi,
    I'm not sure I've fully understood what you require... but here's something you can try.
    Lets say that you search for some user entered criteria and display results to the user in the pop up JSP. I am assuming that there would be some user action on which you want to return something to the parent window and then close the child window.
    You can access the parent window using:
    window.opener.document.<form name>.<field name>
    and then close the pop up window using a simple window.close();
    On the other hand, if you want to close the window w/o any user inputs (directly after the server side processing), then make the server side processing send a status parameter back to the pop up window. For example, set a parameter in the request which will trigger a JavaScript in the pop up window to close itself.
    Hope this helps.
    Cheers !
    Vinay

  • When i try to send email in my hotmail i get this message webkit2 web process.exe stopped working then it closes the window any ideas

    when i try to send email in my hotmail i get this message webkit2 web process.exe stopped working then it closes the window any ideas

    Do you know how it is chaning the addresses?  Can you compare what is send to what it is your address book?
    In the meantime, make a temporary, backup copy of the library and try the following:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home()/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
         User/Home()/Library/Caches/com.apple.iPhoto folder. 
    3 - launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.
    OT

  • Why wont firefox load after i close the window ? it tells me it is already running in the background and to close that window before opening again. took 10 tries before it would load again !

    this has been going on for some time. 2 months maybe. i can hear the hard drive winding up/down after i close the window, and then comes a long narrow blue window stating what i have written.

    See
    * [[Firefox is already running but is not responding]]
    Try closing any running instances of ''firefox.exe'' (and plugincontainer.exe) using something such as Task Manager. That should allow you to then restart Firefox.
    As for iLivid. Possibly it also has associated apps or extensions with names not including the word iLivid. Looking at their own FAQs there are instructions to remove iLivid using the Windows Control panel, and mention of other bundled software that you may wish to remove. It seems it is more of a nuisacne rahter than out and out malware.
    * see http://www.ilivid.com/faq.htm (page scrolls for more info) but includes:
    How do I uninstall the software?
    The software can be removed in a simple was like any other software:
    Go to the Windows Start menu and then to Control Panel > Add/Remove ("Programs & Features" in Vista & Windows 7) and click "Remove" next to the software name (e.g iLivid Download manager / Windows iLivid Toolbar ).
    During the installation bundle software are offered, each can easily be removed following those instructions: Uninstall Yontoo Addon , Uninstall Search Toolbar (powered by Bing) or Uninstall Babylon.

  • Automatically close the window

    Hi All.
    I am having a BSP which has a few buttons. Those buttons call some methods of standard class.
    That method then defines a navigation target as "EXIT_PAGE". This page I have defined in my customized BSP application.
    Now I just want to close the window and do nothing else in this page of my customized application.
    How can I do that?
    Please note that there will be no additional button that I can show to users on clicking of which I could fire the window.close event.
    Can I just navigate to a javascript page which will close the window?
    To elaborate more:
    The standard method calls this statement after doing whatever it has to do:
              navigation->next_page( 'EXIT_FINAL' ).
    Now this page I have defined in my customized BSP as follows:
    Start                                  Navigation Request                  Target
    document_redirect.htm     EXIT_FINAL                                document_final.htm
    Now in this document_final.htm, I just want to close the window and do nothing else without clicking on anything.
    Another related doubt: I am well versed in Webdynpro abap, but not so much in BSP. In web dynpro abap, we can fire windows exit plug and the application knows it is closed. So in SICF, we can write the code to logoff to close the window.
    In BSP, how can we make sure that the code that is writtten in the logoff tab of SICF service is executed? That might also solve my problem.
    Thanks in adv.

    Same thing Durai.
    I actually went to View-SOurce: The following code comes there:
    <h t m l>
    <h ead><title>Appraisal Document            </title></h ead>
    <s cr i p t language="J a v a S c ri pt">
    function exit BSPApplication(){var prop = 'height=100,width=400,top='+(screen.height-100)/2+',left='+(screen.width-400)/2;var out = windowdotopen('document_exit.htm','_blank',prop);documentdotgetElementById("4A527F69BC0E00B2E10080000AFB4223_FRAMESET")dotonunload = null;}</s c ri p t>
    <f ram eset id="4A527F69BC0E00B2E10080000AFB4223_FRAMESET" rows="*,0" on un lo a d="exitBSPApplication();"  resize ="no" framespacing="0" fra meb order="0">
    <fr am e name="4A527F69BC0E00B2E10080000AFB4223_A" src="document_redirect.htm?PREVIOUS_VIEW=">
    <fr  a me name="Block_Back" s r c ="a b out.htm">
    < / f ra meset>
    </h t m l>
    Then I saw that this code is from the starting BSP page document.html. The code in that is as follows:
    < % @ pa g e l a n guage="a ba p" %>
    < %
      " Copy this page into your BSP application, and change line below.
      " This page should always used be as entry point into application.
      DATA: target_page               TYPE STRING VALUE 'document_redirect.htm'.
      DATA: about_page               TYPE STRING VALUE 'about.htm'.
      DATA: do_not_delete_sso2_cookie TYPE XFELD  VALUE SPACE.
    % >
    < h t m l>
      <h e ad>
        <title>< % =  otr(PAOC_HAP_DOCUMENT_UI/TITLE_DOCUMENT) %></title>
      </h e ad>
    <s c ri p t l an guage="J av aS cr  ip  t">
    < %
       DATA: guid TYPE GUID_32.
       CALL FUNCTION 'GUID_CREATE' IMPORTING ev_guid_32 = guid.
    % >
    f u nc tion exit BSPApplication()
    < %
    DATA: pvi TYPE i.   "customer message 319887
    TRY.
       pvi = runtime->portal_version_major.
       CATCH cx_sy_conversion_error.
         pvi = 0.
    ENDTRY.
    if pvi < 6
    or runtime->session_manager->is_running = 0. % >
      var prop = 'height=100,width=400,top='+(screen.height-100)/2+',left='+(screen.width-400)/2;
      var out = windowdotopen('document_exit.htm','_blank',prop);
      < % endif. % >
      documentdotgetElementById("<%=guid%>_FRAMESET")dotonunload = null;
    < / s  c ri p t>
    < %
      if application->frameIsNotInitial is initial.
        application->frameIsNotInitial = 'X'.
    % >
    <f ra meset id="<%=guid%>_FRAMESET" rows="*,0" on u n lo ad="exitBSPApplication();"  resize="no" framespacing="0" frameborder="0">
        <f ra me name="<%=guid%>_A"  s r c ="<%=target_page%>?PREVIOUS_VIEW=<%=previous_VIEW%>">
        <fr am e name="Block_Back"  s r  c="<%= about_page%>">
    < / f rameset>
    < %
      else.
    % >
    <f ra meset id="<%=guid%>_FRAMESET" rows="*,0" resize="no" framespacing="0" frameborder="0">
        <fr a me name="<%=guid%>_A" s r c="<%=target_page%>?PREVIOUS_VIEW=<%=previous_VIEW%>">
        <fr ame name="Block_Back" s r c="<%= about_page%>">
    </f ra meset>
    <%
      endif.
    %>
    </h t m l>
    I tried to put selfdotclose and windowdotclose in the exit BSPApplication().function. But does not work.
    Any clues. Totally lost now
    Thanks in adv.

  • AirPort Express wireless connection, when I surf the news sites so I linked to **** pages. And must close the window. If I use my iPhone with Internet sharing the same computer, then I have no problem. I believe that it is in AirPort Express, and wou

    AirPort Express wireless connection, when I surf the news sites so I linked to **** pages. And must close the window. If I use my iPhone with Internet sharing the same computer, then I have no problem.
    I believe that it is in AirPort Express, and would have to clean it. How do you do that?

    You need to use the Express in router mode.. I think you are trying to use it in bridge mode.. but you need to give us a lot more details.. screenshots might help more than anything.

  • When I try to play several games like: FiFa 2011HD, Real Racing2HD and TransformersHD, after I selected the configurations to start to play it, and then the game close  the window and returns to the Ipad main screen. I upgraded my Ipad at Apple store but

    When I try to play several games like: FiFa 2011HD, Real Racing2HD and TransformersHD, after I selected the configurations to start to play it, and then the game close  the window and returns to the Ipad main screen. I upgraded my Ipad at Apple store but nothing happened. Anyone knows how can I resolve it, please ?

    1. first try to reboot your ipad
    if that don't work then try downloading another app don't matter which one
    and if it fix your problem you can just delete it afterwards

  • Firefox won't open a message tells me it is all ready running I need to close the window to open firefox. Firefox is not open so why do I get this message

    When I try to open firefox a box opens up and tells me firefox is already running in another window and I need to close the window if I want to open firefox in a new window. Firefox is already closed, nothing is left open when I close out firefox. I would only have this problem once in a while but now it is happening more often why?

    Open Task Manager and click on the Processes tab. Scroll down to "Firefox.exe" , click on that line and click on "End Process" button.

Maybe you are looking for