Close the Window on Button Click.

please can someone help.
I am trying to close the window in which my 'Exit'button is defined.
For this I am using:
button.addActionListener(this);
public void actionPerformed(ActionEvent e) {
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
     //dispose();
But the window still doesnt close,till I click on the 'X' icon.

action{
if(e.getSource() == myButton){
jframe.setVisible(false)
// possibly jframe.dispose() depending on what you are trying to do
//if you are tying to exit the program all together
System.exit(0);
}http://mindprod.com/jgloss/close.html
xpost
http://forum.java.sun.com/thread.jspa?threadID=764106&tstart=0

Similar Messages

  • When a website launches a new window to enter information, Firefox no longer automatically closes the window when you click the submit button. Why?

    For example, when I create a message in my autoresponder service and want to attach an image a new window opens up so I can enter the details of the image (url, position, alt text). When I click the Save button, the information is captured but the window remains open and I have to manually close it.
    Firefox used to close the window automatically.

    YES!! Thank you jscher2000! You sir are a legend. Thanks for this, changed the newtaburl in about:config, totally worked. Nope, never saw it happening! Speedy machine this one :P Yep, that change completely sorted the issue, just opened about 741 new tabs through the shortcut on my mouse just to celebrate. Thanks guys who helped, no thanks those who didn't.

  • How to close the browser on button click?

    Hi,
    On a HTML page, I have a button labeled as "Close". When user click the button, I want to close the browser. I am using Apex 4 with 10g.
    I created the following process which I call on pressing the close button:
    BEGIN
    htp.p('<body>');
    htp.p('<script type="text/javascript">');
    --htp.p('window.opener.doSubmit();');
    htp.p('window.close();');
    htp.p('</script>');
    htp.p('</body>');
    END;But it shows the below in the browser instead of closing it.
    Location: f?p=17638:9:3591448756041585::NO
    Any wayout?
    Thx

    For popup windows I use button code / javascript such as this.
    The self function refere to the correct window, while window.close my be connected to the wrong (parent) window.
    input type="button" value="Cancel" onclick="self.close();"  id="CANCEL"Edited by: Sven W. on May 26, 2011 2:46 PM

  • 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

  • How to close the detach popup on click of a button in the panel collection

    Hi,
    I'm using Jdeveloper 11.1.2.3.0.
    I have an af table surrounded by panel collection. There is a button on panel collection to commit the changes in the table.
    Clicked detach button to view the table in full browser.
    On click of Commit button, the detach popup is not closed. I have set partialSubmit of that button to false. Then also detach popup is not closed.
    Can anybody suggest me how to close the detach popup on click of a button in the toolbar.
    Thanks,
    Vinod

    Hi Frank,
    Thanks for your response. Popup is not closed.
    I tried this approach, when the view tree is navigated on the Detach, I see that the tree is same as if it is traversed on the page without detach.
    Printed client id and UI component class in the while loop, result is as below.
    r1:0:pc1:t3 class oracle.adf.view.rich.component.rich.layout.RichToolbar
    r1:0:pc1 class oracle.adf.view.rich.component.rich.output.RichPanelCollection
    r1:0:ph2 class oracle.adf.view.rich.component.rich.layout.RichPanelHeader
    r1:0:pgl1 class oracle.adf.view.rich.component.rich.layout.RichPanelGroupLayout
    r1 class oracle.adf.view.rich.component.rich.fragment.RichRegion
    pgl1 class oracle.adf.view.rich.component.rich.layout.RichPanelGroupLayout
    db2 class oracle.adf.view.rich.component.rich.layout.RichDecorativeBox
    db1 class oracle.adf.view.rich.component.rich.layout.RichDecorativeBox
    psl1 class oracle.adf.view.rich.component.rich.layout.RichPanelStretchLayout
    ps1 class oracle.adf.view.rich.component.rich.layout.RichPanelSplitter
    f1 class oracle.adf.view.rich.component.rich.RichForm
    Tried with setting partialsubmit property to false on the command button, still the popup is not closed and my Faces Message are shown behind the detach popup.
    Thanks,
    Vinod

  • 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.

  • 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).

  • 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 external window using Button

    Hi all,
    I have implemented a Web Dynpro application which runs in a portal. It opens in a separate browser window.
    Now I have to implement a "close" functionality inside this application, which closes the window when the user clicks on a Button (or LinkToUrl -- never mind).
    What would be the best way to implement this on NetWeaver 2004s?
    Regards,
    Martin

    HI,
    You can use an external html file to close window.
    Looks like your trying to close window from that window itself.
    then create an close.html file and put it into mimes folder
    access this file
    String url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"close.html");
    wdThis.wdGetViewController().wdFirePlugExit(url);
    in close.html write a javascript which contains following function
    <html>
    <SCRPT LANGUAGE='JavaScript'>
    function win_close()
    window.parent.opener = top;
    window.parent.close();
    window.opener.close();
    </SCRPT>
    <body onlod='javascript:win_close()'>
    </body>
    </html>

  • 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.

  • (Mountain Lion) suddenly the screen turns black, and I have to use the switch to turn it on. And, the screen turns to zoom, and the only way to turn to normal is to close the window and start all over again?

    (Mountain Lion) suddenly the screen turns black, and I have to use the on/off switch to turn it on. And, the screen turns to zoom, and the only way to return to normal is to close the window and start all over again?

    Does the screen go black while you are using the machine? ...or after it has sat idle for a bit?
    If it happens while you're using the machine, check to see if a hot corner has been set for sleep. You can do that here: System Preferences > Desktop & Screen Saver > Screen Saver and click the button labelled "Hot Corners..." in the lower right.
    If it happens after a bit of idle time, that's normal sleep behavior. The delay can be adjusyed here: System Preferences > Energy Saver.
    In either case, pressing any key on the keyboard should bring it out of sleep.
    Re zooming -
    If this happens while in Safari, and you are using an Apple Magic Mouse, a default setting applicable to it is that a soft double-tap on the mouse will zoom the Safari window. A second double-tap will bring it back.
    If it is the entire screen that is zooming, Control plus scroll gesture on the mouse will zoom the whole screen. Repeat with the opposite scroll gesture to bring it back.

  • 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

  • Programmatically Open and close panel accordion on button click

    Hi All,
    Im using JDev 11.1.1.4 and adf faces application.
    My requirement is to open/close panel accordion on button click programmatically.Kindly have a look at below figured one
    Panel accordion Open Button
    | ShowDetail1 //Consider first one is open inside close button is there to close this pane..
    |
    |
    |
    Close Button
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Show detail2 open button
    Show details3 open button
    Any idea...
    Thanks,

    Thanks Mr.frank...
    But disclosed property is to make the showdetail to disclose or not.. but requirement is to open panel accordion on button click
    By default using panel accordion have arrow icon in left to open in a same way if i open the second one, first will get close automatically...
    Actually is there any way to do the default process (open/close) programmatically...

  • Okay, i have 2 bugs with maverick.  First, when I delete a file within a window, the files deletes but the preview doesn't delete until I close the window and reopen it.  Second, I work on a network of computers and the search feature is now buggy...

    Okay, i have 2 bugs with maverick.  First, when I delete a file within a window, the files deletes but the preview doesn't delete until I close the window and reopen it.  Second, I work on a network of computers and the search feature is now buggy...  When I search for a file, A) it asks me if it's a name, or it wont produce anything, and B), its slower than in prior OS versions and in some instances I have to toggle to a different directory and go back to my original directory in the search: menu bar or the search wont produce anything...  Very buggy. 

    It appears to me that network file access is buggy in Maverick.
    In my case I have a USB Drive attached to airport extreme (new model) and when I open folders on that drive they all appear empty. If I right click and I select get info after a few minutes! I get a list of the content.
    It makes impossible navigate a directory tree.
    File access has been trashed in Maverick.
    They have improved (read broken) Finder. I need to manage a way to downgrade to Lion again.

  • 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!

Maybe you are looking for

  • Purchased movie does not show up in Apple tv

    Hello, I just bought a movie (Valkryie with Tom Cruise)...and for some reason it does not show up in my purchased movies on any of my devices (Apple TV, iPhone) and it also does not show up as purchased in my iTunes library. This is the only movie wh

  • What are the compatable web browsers for Oracle Enterprise Manager DB console 11.2?

    Database: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production Web browser: IE 8 C:\Users\x-msarwar3>emctl status agent Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0 Copyright (c) 1996, 2011 Oracle Corporat

  • Date format in sapscript

    hi all, i used set date mask command for my script form to change the date format. this command works on other windows but in one window it doesn't work. i did the same command in that window. can anyone help me on this. many thanks.

  • Width of Hightlighted Field on Validation Error

    Hi Is there anyway to control the width of the Red Highlight that the Mandatory fields get? Regards Meir

  • Create OS directory and write file from BLOB

    Hi, i want to create via a stored PL/SQL procedure a directory in an OS filesystem (Windows NTFS) and afterwards write a file (Type: DOC, PDF, ...) from a BLOB table to that directory. The filesystem is one to the node (where the database instance 10