Closing a window or frame in amenu application

Sir,
I am at present doing a project in java swing regarding preventive healthcare systems. I would like to let you know a problem i am confrontin now. The problem with my aplication is :
It is a menu driven application (The previous application was in VB). When I select an item in the menu, i get a new JFrame with applications like --- add member,registration etc. I have an OK button in each of these frames.
The problem is that when i click the OK button, the whole application is exitted , as i have given System.exit(0) in the ActionListener of the OK button. What I want is "only that particular frame has to go and the main form(with the menu on it) should stay on."
Please suggest a solution for this and please reply to me.
Thanking You,
Yours sincerely,
Ann Baby.

In the ones you don't want to exit, put
frame.hide();
or
frame.setVisible(false);
instead of System.exit(0);

Similar Messages

  • How do I set Safari to prompt before closing multiple tabs OR reopen all of the closed tabs when when I relaunch the application?  The "Reopen all windows from last session" is unselectable.

    How do I set Safari to prompt before closing multiple tabs OR reopen all of the closed tabs when when I relaunch the application?  The "Reopen all windows from last session" is unselectable.

    It would seem if your choose "Show my windows and tabs from last time" '''''and''''',
    *when you last closed Firefox, you had no web site open (just a blank tab), that it would open just that blank tab
    *when you last closed Firefox, you had one or more tabs/web site open, that would allow you to "Restore Previous Session"
    #Have you tried that?
    #If so, what is happening in each circumstance when you reopen Firefox?
    '''Restore Previous Session'''<br />
    Open tabs are automatically saved when closing Firefox beginning in Firefox 4. To open your last session, after Firefox starts, click History > Restore Previous Session. For this to work
    #You must be remembering history (Options > Privacy > Remember my browsing history).
    #*See [https://support.mozilla.com/en-US/kb/Options%20window%20-%20Privacy%20panel Options window-Privacy panel]
    #You must not be using Private Browsing or permanent Private Browsing
    #*See [https://support.mozilla.com/en-US/kb/Private%20Browsing Private Browsing]
    #You must not use Clear Recent History or Clear history when Firefox closes
    #*See [https://support.mozilla.com/en-US/kb/Clear%20Recent%20History Clear Recent History]
    #*See [https://support.mozilla.com/en-US/kb/Options%20window%20-%20Privacy%20panel Options window-Privacy panel]
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You need to update some plug-ins:
    *Plug-in check: https://www-trunk.stage.mozilla.com/en-US/plugincheck/
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]

  • Quitting the Application Before Closing the Window?

    I have a 6 day old iMac running Snow Leopard. I already knew that closing the window on most Apps did not close the program, so instead of closing the window, I would just click on, ie, "Quit Safari" and the Safari window would then close. I don't do that anymore, now I close the Window first, and then quit the App. Could I have caused any harm to the OS by just quitting the App, and letting that close the window?

    It's OK to close the app without closing the window. I never close the windows when quitting an app, I just hit CMD-Q. It does no damage.
    Regards,
    Captfred

  • Problem in Closing Browser window from an Applet.

    I have wriiten a small Applet progarm that calls a Javascript function in the opening window, to close the window in which it is loaded.The Applet window is a PopUp window from one of my application's window.
    First time I start my application and load that Applet and then close the frame window,it works fine that the browser window will close, when the frame window is closed.It calls the window closing event in that applet stop method is called and In stop methd a closeLaunchedBrowser method will called this has a Javascript method and the Method closes the window using the self.close() method.
    But now if I continue this process of launching applet and then closing frame window, initial 1 or 2 steps it has know problem when I continue this, after 3 or 4 steps, it result in browser hang/crash.
    I am using java version 1.4.2_01 or higher and IE or Firefox(any other NetScape based) browser to load applet.It works fine with IE but getting problem in case of Firefox(any other NetScape based).
    The error dialog information and related event log generated is shown below :
    The dialog which is displayed before crashing of firefox has information :
    "firefox.exe has generated errors and it will closed by windows.you will need to restart the program.
    An error log is being created."
    The error log information :
    Source : Browser Event ID: 8032
    "The browser service has failed to retrieve the backup list too many times on transport \Device\NetBT_Tcpip_{611A64A2-8F4B-409E-9AB2-0D9BF741E791}. The backup browser is stopping.
    The code related to this is given below.
    import javax.swing.JApplet;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import netscape.javascript.JSObject;
    public class TestApplet extends JApplet {
    protected JSObject win = null;
    private JFrame frame = null;
    private boolean alreadyClosed = false;
    public void init(){
    this.win = JSObject.getWindow(this);
    frame = new JFrame("Test Frame");
    frame.setSize(300, 400);
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.out.println("windowClosing");
    TestApplet.this.stop();
    frame.show();
    public void stop() {
    if (!alreadyClosed) {
    alreadyClosed = true;
    closeLaunchedBrowser();
    System.gc();
    System.runFinalization();
    private void closeLaunchedBrowser() {
    final TestApplet thisObject = this;
    Runnable r = new Runnable() {
    public void run() {
    try {
    JSObject win = (JSObject)JSObject.getWindow(thisObject);
    if (win != null && win.toString() != null) {
    //win.eval("top.opener=self;self.close();");
    //win.call("close", null);
    win.eval("self.close();");
    } catch (Exception e) {
    Thread t = new Thread(r);
    t.start();
    }If any one know solution regarding how to aviod this crash of browser please let me know. I will be very thankful to you.
    Thanks.

    Right, I sort of tracked down some code that uses getMethods to allow me to invoke a Javascript command. It is not pretty and took a little bit of editing to get to work but it does the job without putting JS stuff into my HTML.
    However it is causing some problems. If I open one of my other applets it will only let me close that window and the previous applets ceases to respond at all. I think this may be because the invoke gets the JSObject which is the window and somehow having more than one applet open in different windows is causing it to get confused and is locking the first window and only responding to the second.
    I have seen a much simpler method that uses:
    import netscape.javascript.*;
    and JSObject to get the window but my compiler complains about the import. Any further suggestions or an example would be welcome as my current solution is a bit limited as you can effectively only have one window open at a time which doesn't suit my needs.
    Many thanks.
    Mark.

  • On closing browser window i want to update database

    I an doing it by onUnload of javascript i poping up jsp and doing database transaction there . But probelm I encountered is when page is refreshed then also this script is poping up window and doing transactions which i don't want .
    Please help out this , Very Urget
    Mohan

    thanks for U reply
    But my application it is like this a person is given with login screen after login is valid i am enter in to window having 3 frames . I am updating database on login . if user closed the window by windows cross button then database status should be updated .
    Please solve this .
    And onUnload is not working in Nescape 4.7
    Mohan

  • Acrobat XI full screen mode: how to hide the window control frame

    i mainly use Acrobat to prepare full screen presentations and training, and it is annoying not being able to hide the window control
    i previous versions the window control frame was always hidden / please bring this option back

    Thanks, but my ID CS6 is already set to open as a "normal window".  What I'm trying to resolve is the sizing and positioning of that "normal window".
    I found one older post (http://forums.adobe.com/message/4609791) from someone who has the same problem, and it looks as if their question was never resolved, either.  I haven't tried the script mentioned in the other message that has a link from that one.  Btw, I've never seen a Window > Application Frame option within InDesign CSx for Microsoft Windows.

  • Closed Project Window Stays Open

    I have one project out of three where this is a problem.  I can end the project but the window does not close.
    I am using Captivate 4 and I have gone to preferences and changed end of project to be Close Project. Even at that, the last slide wants to keep going. I want it to freeze so it can be read. I put a button on it to stop the slide and then had to put a dummy slide at the back to close the project once the viewer hits the Close button.
    On the other projects, I can just let the slide fade out. Why does the window stay open? Is there a solution? I could not find this listed in the forum but was sure this was an issue in versions 2 and 3 as well.
    Thanks.
    Jeffrey Riley

    Do you mean like this?
    Indeed, that is the new behaviour. You have to make a selection, before closing the window.
    The new GarageBand does not quit, when closing the main application window. This way you faster switch between projects. You do not have to quit and relaunch.
    If you want GarageBand to quit, use the quit command ⌘Q instead of closing the main window.
    -- Léonie

  • Trigger Javascript when closing browser window from CP8

    I worry this isn't possible but here goes....any help would be incredible.
    Recently I was given some great advice on how to trigger a Javascript action in the frame on our LMS which the Captivate file plays in.
    It works perfectly and on the final page triggers the Javascript which send usage back to the LMS and forward the user to a page which allows them to rate the course.
    The code was as follows:
    top.code.closeSCOContent();
    closeSCOContent() is something written into our LMS.
    However the obvious issue occurs when a user just closes the browser window and for some reason our LMS doesn't record any bookmarking or any data.
    The only way it seems to do this is if that function is called.
    So using the window.onunload() or the DOFinish; function is there a way I can edit any file in the Captivate output to trigger this function when closing the browser?
    Long shot I know but currently the best I have managed is getting the course to trigger this as soon as it loads rather than closing the window?
    Massive thanks in advance for any advice.

    Any solution to ensure the data is written back to the LMS would solve the issue.
    Currently when the close button is pressed nothing happens at all and it's a big problem.
    Triggering this .closeSCOContent() function would be the ideal, but if it's not possible anything to write back would be best.
    When you say <body onbeforeunload="top.code.closeSCOContent();">
    Do you mean putting this in the HTML file of the output which currently is:
    <body bgcolor="#f2f2f2">
    and change this to:
    <body onbeforeunload="top.code.closeSCOContent();" body bgcolor="#f2f2f2">

  • How to clear sessions in java while closing the window

    Dear all,
    When I am closing the window if I click 'x' on window how to handle that event in java script , or any other way for this event handling.
    Sudheendra.

    Thank you very much ,
    In my application for each login i am using different sessions.
    In one login if a user navigating then there is no chance of opening different windows.
    So when the user without clicking logout button , if he closes the window by clicking 'x' , then the session allocated for this login is retaining until the session time out.
    so i want to invalidate the session for this particular login .
    Thank you,
    Sudheendra.

  • Java.exe has generated errors and will be closed by windows

    We are running win2000, with jre 1.4 and getting the following message at a particular point in our program:
    <b>"java.exe has generated errors and will be closed by windows. You will need to restart the program. An error log is being created."</b>
    I have 2 questions:
    1) does anyone know what would cause this?
    2) does anyone know where this log file is generated to?
    many thanks - there are a few duke dollars in it.

    We are getting same error with jdk1.6,
    we can get drwtsn32.log file for user home/documents folder by running with following option. -XX:+ShowMessageBoxOnError
    We got following log message:
    Application exception occurred:
    App: (pid=2288)
    When: 2/5/2008 @ 18:20:44.700
    Exception number: c0000005 (access violation)
    ----> System Information <----
    Computer Name: MAX-20
    User Name: Suresh.A
    Number of Processors: 1
    Processor Type: x86 Family 15 Model 2 Stepping 9
    Windows 2000 Version: 5.0
    Current Build: 2195
    Service Pack: 4
    Current Type: Uniprocessor Free
    Registered Organization: maxem
    Registered Owner: max-20
    has anybody found any solution / tools to identify this kind of issue?
    Thanks
    Nimalan

  • How can Java trap closing DOS window

    Hi all:
    This pertains to Windows.
    I have an application which needs to be shut down in a controlled fashion. Unfortunately I can't get my users to cooperate.
    I have learned how to trap for Ctrl-C and do a controlled shut down.
    I can't prevent them from closing the window the program runs in or the other ways to shut a program down from Windows.
    Is there any way to trap for the user closing the appliation (either by clicking the X in the top right or by choosing Close-AltF4 from the pull down). I would like to trap for the event and do a controlled shut down of the application before Windows pulls the gound out from under it.
    Thank!
    BillB

    Check this out:
    http://java.sun.com/developer/TechTips/2000/tt0711.html

  • Mx.core.Window - prevent user from closing the window?

    Hi,
    mx.core.Window has properties 'maximizable' &
    'minimizable', but there doesn't seem to be any 'closable'
    property. In my application I'm creating another window (apart from
    the main application window) that needs to be open the whole time
    the application is running. If I can't prevent the user from
    closing the window, then I'll have to rig up some code to
    automatically re-open it if the user closes it. I'm hoping there's
    a way to prevent the user from closing the window in the first
    place though.
    I'll much appreciate any ideas - thanks :)

    Listen for the window's closing event and call
    preventDefault().

  • Disabling WINDOWS CTRL+C in Java Application

    Hello Friends,
    I want to use CNTRL+C in my SWING Application. But in Windows CTRL+C is used for COPY. I want to use CTRL+C for different purpose. So I want to disable WINDOWS CNTRL+C in my application.
    Is there any way to achieve this?
    Thanks in Advance
    Abhijai

    Just one suggestion:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class DisablingControlC {
      Object[][] data = {{"aaa","bbb"},{"ccc","ddd"}};
      String[] columnNames = {"000","111"};
      JTable table = new JTable(new DefaultTableModel(data,columnNames));
      JButton button = new JButton();
      private JPanel makeUI() {
        KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK);
        InputMap im = table.getInputMap(
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        im.put(ks, "different_purpose");
        table.getActionMap().put("different_purpose", new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            if(table.getSelectedRowCount()>0) {
              System.out.println("copy");
              table.getTransferHandler().getCopyAction().actionPerformed(e);
            }else{
              System.out.println("different purpose");
        button.setAction(new AbstractAction("clear selection") {
          public void actionPerformed(ActionEvent e) {
            table.changeSelection(0, columnNames.length, false, false);
            table.clearSelection();
        button.setFocusable(false);
        JPanel p = new JPanel(new BorderLayout());
        p.add(new JScrollPane(table));
        p.add(button, BorderLayout.SOUTH);
        return p;
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          public void run() {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.getContentPane().add(new DisablingControlC().makeUI());
            frame.setSize(new Dimension(320,240));
            frame.setVisible(true);
    }Edited by: aterai on 2009/01/23 16:08

  • Closing document window inside of the MDI

    We have just one "document" window open inside of the Forms run-time application window. Does anyone know how to close this document window without closing the whole application?
    Thank you very much.

    Bogdan,
    we are trying to close the sole document window we have inside of our MDI application, leaving the application itself open. By comparison, you can leave MS Word application window open without having any document windows in it. I am starting to doubt it's possible at all in Forms. To re-phrase the question, is having at least one document window open at all times a requirement for MDI application?
    Thank you.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Bogdan Dincescu ([email protected]):
    I understand that the one document window is the main window of the form that is curenntly running and that you have one only form running. Closing that window you close that form, so how would the application know any better then closing.
    Please be more specific as to what you really need to do.
    Best wishes,
    BD.<HR></BLOCKQUOTE>
    null

  • Popup to confirm when closing browser window?

    Hi
    I want to display popup confirm window when closing browser window, "changes will be lost" yes or no. for this i searched forums got some idea, about "WORK PROTECT MODE". this will work only when our application running from portal. my doubt is where should i write code for this??? any help
    Thanks,
    kris.

    Hi Thomas,
    We are on ECC6.0 enph5.
    In system configuration in epc.loader(service) the value for work protect mode is set as 1 - Protect unsaved data (open page in a new window) 
    1)Is it possible to override this value within WD ABAP application? for example show popup window when there is unsaved data
    2)In this scenario what is the significance of L_PORTAL_MANAGER->SET_WORK_PROTECT_MODE
    and   L_PORTAL_MANAGER->SET_APPLICATION_DIRTY_FLAG
    3)Where exactly  L_PORTAL_MANAGER->SET_APPLICATION_DIRTY_FLAG has to coded. It does trigger modify method of the view.
    Thanks,
    chamu

Maybe you are looking for