Alternative window closing

Hi,
I was wondering if it is possible to close a pop up window (pane with a text area) with a key press such as Alt-Enter (or something) similar that does not involve moving the mouse to the top right-hand corner of the pop-up and pressing the X?

I know how to close it, but to use a key press, will i have to add a menubar for example, then assign a menu item a key such as ctrl-x, then within this actionperformed method then dispose of the window.
Is there any other way to do it apart from with a menu bar (i.e. no buttons required)?

Similar Messages

  • 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

  • When I open itunes I get a 'DATA EXECUTION PREVENTION' 'Windows closed program'. Can anybody help please.

    When open iTunes it starts OK then a message from Windows appears, 'DATA EXECUTION PREVENTION Windows closed program'. Then the whole thing shuts down. Does anybody know how to sort this out please. I am using XP operating system and have recently updated iTunes. Thanks

    Hi alanfromharlow,
    It sounds as if iTunes is failing to launch properly on your Windows computer. You don’t mention what version of Windows you have, but one of these two articles should be useful to you -
    iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues
    http://support.apple.com/kb/TS1717
    iTunes for Windows XP: Troubleshooting unexpected quits, freezes, or launch issues
    http://support.apple.com/kb/TS1421
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • Data changes saved when pop-up window closed instead of using Save button/action.

    We encountered an odd application behavior and we cannot tell if this is standard functionality or not.  When a spec is an a workflow step that is Signature Request, the Requestee can open a link to view the spec.  When the user also has edit permissions, they get the edit icon in the popup window.  We had a user that editted the spec then decided not to save the changes, so used the Close (red ex on popup) instead of the Action: Cancel button on the application menu. User expected that changes made would not be saved. It turns out that clicking the window closed save the modifications without any warning.  User expected Close to work like Cancel instead of Save.  Is this normal application behavior?
    Details.  Version 6.1.1.1 on IE9 with popup. 

    Did they make a change, close the popup, then workflow the Signature Request? Is so, then this is behavior we expect: When you are viewing a spec, you are viewing the in memory version of it, meaning that if you edit the spec, the changes are made to the in-memory version. If then clicked close, the in memory data is still loaded for that spec, and it may be that the signature request workflow event then saves the spec with those changes. The cancel button would have reverted the changes.
    You can, however, log an Enhancement Request for having the window close act like the Cancel.
    Thanks
    Ron

  • 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

  • Catching window closing events from JFrame

    I'm having problems catching windowClosing() events from a JFrame (just doesn't get to my event listener it would seem!).
    I register and setup a window listener in the constructor of my JFrame class. Prior to this I set the default close operation as DO_NOTHING_ON_CLOSE (as you're suppose to if tyou want to handle window closing events).
    When user clicks on x (window terminate) button (in WIN systems), nothing is dispatched to my event listener. Any ideas?
    Extract from constructor:
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new MainWindowListener(this));
    MainWindowListener looks as follows (EDImemConvert extends JFrame):
    class MainWindowListener extends WindowAdapter
    private EDImemConvert f;
    public MainWindowListener(EDImemConvert f)
    this.f = f;
    public void windowClosing(WindowEvent e)
    System.out.println("gets here...");
    f.ReturnResources();
    f.dispose();
    System.exit(0);
    }

    This works for meimport java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test extends JFrame {
      public Test() {
        addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent we) { System.exit(0); }
        setSize(300,300);
        setVisible(true);
      public static void main(String args[]) { new Test(); }
    }Normally, I just use this line
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    instead of adding a listener. It will clean up everything nicely.

  • Dispose objects during window closing

    I use vb to call java application through batch file (.bat) to connect to another java app to send message. Since the java application is executing in command prompt window, if the window accidentally closed, is it possible to close the connection, terminate loop, dispose objects properly during window closing? most importantly, the program at the other side knows the the connection is closed and message stop sending by the java app? Any suggestion?
    Thanks.

    Does your app have a fixed main window from where you launch other windows? If so, don't call System.exit(0) in windowClosing event for any of those windows except the main window and it would solve your problem.
    Otherwise you would need to somehow keep track of all the open windows in your application and in the windowClosing method you would check to see how many windows are open currently. If the window being closed is the only window open at that time, call System.exit(0). Else don't call it.
    Hope this helps.

  • Assignment Window Closed

    After insert employer information in assignment window (GOSI Details saudi arabia) the window closed suddenly.
    any hints

    The problem that i should enter this type of information (GOSI) .
    Emp A when i insert GOSI Info and commit form its close .
    Emp B if GOSI Info missing i can open Assignment window without any problem.
    Also the assignment window in fastpath after serching its close immediataly.
    Regards.

  • Safari crash when window closed

    Like the post earlier, safari crashes when a window closed. I used to have Speed Download, however, it is no longer on my system, and when i searched for it (and permutations of it I found nothing.
    I tried looking in the crash log, but I dont know what Im looking for.
    I would appreciate any further suggestions.
    Thanks

    Hello Illan Wall and welcome to discussions,
    Speed Down Load MUST be removed by using their own un-installer package that comes with it.
    Did you do that or did you just trash the Application?
    Hope that helps some
    Regards
    Ian

  • Detect window closing event in AIR application

    How do I detect the window closing event in an AIR app? Tried
    the following.
    deactivate and windowDeactivate events in the
    WindowedApplication tag.
    addEventListener(Event.CLOSING, onClose);
    addEventListener(AIREvent.APPLICATION_DEACTIVATE onClose);
    addEventListener(AIREvent.WINDOW_DEACTIVATE, onClose);
    None of them seem to work.
    Any ideas?
    Thanks
    CS

    The following works for me:
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    closing="traceEvent(event)"
    windowDeactivate="traceEvent(event)"
    applicationDeactivate="traceEvent(event)">
    <mx:Script>
    <![CDATA[
    public function traceEvent(event:Event):void{
    trace(event.type);
    ]]>
    </mx:Script>
    </mx:WindowedApplication>
    As does:
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    applicationComplete="init()">
    <mx:Script>
    <![CDATA[
    import mx.events.AIREvent;
    public function init():void{
    this.addEventListener(Event.CLOSING, traceEvent);
    this.addEventListener(AIREvent.WINDOW_DEACTIVATE,
    traceEvent);
    this.addEventListener(AIREvent.APPLICATION_DEACTIVATE,
    traceEvent);
    public function traceEvent(event:Event):void{
    trace(event.type);
    ]]>
    </mx:Script>
    </mx:WindowedApplication>

  • How to trap client browser window closing thru JSP or servlets

    How to trap client browser window closing thru JSP or servlets?
    Gunjan

    Hi
    Though some JavaScripts may provide you with solutions , yet there is no reliable way to detect the closing of the browser by the servlet. One way to achieve detection of user quitting a session is setting session timeouts ion the server side. This can be done either through the web.xml file or programatically by setting the session.setMaxInactiveInterval().
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems Inc
    http://www.sun.com/developers/support

  • Messages default with texting window closed?

    Is there any way I can make Messages default with the Messages texting window closed.  I use the ichat features only and the Messages texting window is irritating.  Any thoughts...

    You can't do this. Close it when you open it

  • Frame window closing

    Hi friends,
    please help me in following situation.
    I have a frame1, where i have a button to open new frame2. this frame 2 opens some other frames.
    When i close main frame1, i want to trigger a event or execute a method on other frames. i tried window closing and window closed events from frame1 or frame2.
    frame2 and frame3 windows r just closing without any events when i close main frame1.
    frame2 and frame3 must extend JFrame not JDialog.
    thanks,

    make in each frame a lille method that calls the next frame (if there is one) and waits until he gets something in return...
    so 1 calls 2, 2 calls 3....
    3 is the last frame and shuts itself down, but first it returns a value to 2.
    then 2 knows it can return a value to 1 and closes itself...
    that's the thing i would do... but never tried it yet so dunno about the speed it goes....
    leme know if I helped you out.
    SeJo

  • Closing a Swing App with Window Closing Event With Dialogs On Close

    A while back I started a thread discussing how to neatly close a Swing app using both the standard window "X" button and a custom action such as a File menu with an Exit menu item. Ultimately, I came to the conclusion that the cleanest solution in many cases is to use a default close operation of JFrame.EXIT_ON_CLOSE and in any custom actions manually fire a WindowEvent with WindowEvent.WINDOW_CLOSING. Using this strategy, both the "X" button and the custom action act in the same manner and can be successfully intercepted by listening for a window closing event if any cleanup is required; furthermore, the cleanup could use dialogs to prompt for user actions without any ill effects.
    I did, however, encounter one oddity that I mentioned in the previous thread. A dialog launched through SwingUtilities.invokeLater in the cleanup method would cause the app to not shutdown. This is somewhat of an academic curiosity as I am not sure you would ever have a rational need to do this, but I thought it would be interesting to explore more fully. Here is a complete example that demonstrates; see what you think:
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.BoxLayout;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    public class CloseByWindowClosingTest {
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        launchGUI();
         private static void launchGUI() {
              final JFrame frame = new JFrame("Close By Window Closing Test");
              JPanel panel = new JPanel();
              panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
              JButton button1 = new JButton("No Dialog Close");
              JButton button2 = new JButton("Dialog On Close");
              JButton button3 = new JButton("Invoke Later Dialog On Close");
              button1.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        postWindowClosingEvent(frame);
              button2.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        JOptionPane.showMessageDialog(frame, "Test Dialog");
                        postWindowClosingEvent(frame);
              button3.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        SwingUtilities.invokeLater(new Runnable() {
                             public void run() {
                                  JOptionPane.showMessageDialog(frame, "Test Dialog");
                        postWindowClosingEvent(frame);
              panel.add(button1);
              panel.add(button2);
              panel.add(button3);
              frame.setContentPane(panel);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.addWindowListener(new WindowAdapter() {
                   @Override
                   public void windowClosing(WindowEvent event) {
                        System.out.println("Received Window Closing Event");
              frame.setVisible(true);
         private static void postWindowClosingEvent(JFrame frame) {
              WindowEvent windowClosingEvent = new WindowEvent(frame, WindowEvent.WINDOW_CLOSING);
              frame.getToolkit().getSystemEventQueue().postEvent(windowClosingEvent);
    }An additional note not in the example -- if in the button 3 scenario you were to put the window closing event posting inside the invoke later, the app then again closes. However, as implemented, what is it that causes button 3 to not result in the application closing?
    Edited by: Skotty on Aug 11, 2009 5:08 PM -- Modified example code -- added the WindowAdapter to the frame as a window listener to show which buttons cause listeners to receive the window closing event.

    I'm not sure I understand why any "cleanup" code would need to use SwingUtilities.invokeLater() to do anything. Assuming this "cleanup method" was called in response to a WindowEvent, it's already being called on the EDT.
    IIRC, my approach to this "problem" was to set the JFrame to DO_NOTHING_ON_CLOSE. I create a "doExit()" method that does any cleanup and exits the application (and possibly allows the user to cancel the app closing, if so desired). Then I create a WindowListener that calls doExit() on windowClosingEvents, and have my "exit action" call doExit() as well. Seems to work fine for me.

  • Performing some actions before window closing in browser

    this can be done by <body onbeforeunload='delcookie()'>
    delete cookie is a javascript function where i put inthe code to delete the cookie of my page when some one closes the page or some thing else load in that window.
    this works even if window closes or some other page loads into the window. onunload can also be used it .it works in the second case only.

    Hi Sunil,
    You can retrieve the application properties in your code by:
    IWDApplicationInfo application = wdComponentAPI.getApplication().getApplicationInfo();
    String value = application.findInApplicationProperties("<property name>").getValue();
    for eg: you can retrieve expiration time as:
    application.findInApplicationProperties("sap.expirationTime").getValue();
    But expiration time is the time after which the application expires and has nothing to do with the real time
    About the application closing, as far as I know there is no event in webdynpro to capture the window closing event. So it depends on how the user closes the application. If he closes the application from within it using some button or link, then you can very well write the required code there. If he closes the browser directly, then I don't think you can handle that.
    Hope this helps,
    Best Regards,
    Nibu.

Maybe you are looking for