Dialog/Frame window not closing

I have an instruction dialog that pops up in an application, but if the close (X) is pressed it doesn't close the dialog/Frame.
Dimension dem = getSize();
               Frame r = new Frame();                    
               Dialog d = new Dialog(r);
               TextArea t = new TextArea("",100,100,TextArea.SCROLLBARS_NONE);
               t.setBackground(new Color(0,0,102));
               t.setForeground(Color.white);
               t.setFont(new Font("Helvetica",6,14));
               t.append(
                    "Grammar Checking Instructions: "+"\n\n"+
                    " -Use the Lexicon provided to creates a sentence for grammatical"+"\n"+
                    " checking."+"\n"+
                    " -The sentence can be typed in the text field provided or the user can"+"\n"+
                    " load a sentence from a file. (*.txt format)"+"\n"+
                    " -Press the 'Check Sentence' button for the sentence to be analyzed"+"\n\n"+
                    "Grammar Rules: "+"\n\n"+
                    " S -> NP Pred"+"\n"+
                    " Pred -> v NP PP | v PP NP | v NP | v PP | v"+"\n"+
                    " PP -> p NP"+"\n"+
                    " NP -> det. NP* | NP*"+"\n"+
                    " NP* -> adj NP* | n");
               d.add(t);
               d.setTitle("Grammar Checking");
               d.setSize(475,300);
               d.setLocation(dem.height/2 -140,dem.width/2 -40);
               d.setResizable(false);
               d.show();
               r.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}});     
thanks for the help,
steve

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test extends JFrame {
  JDialog myDialog;
  public Test() {
    myDialog = new JDialog(this,"Sample Dialog");
    myDialog.setSize(50,50);
    myDialog.getContentPane().add(new JLabel("Hello"));
    JPanel content = (JPanel)getContentPane();
    JButton myButton = new JButton("Dialog");
    content.add(myButton);
    myButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
     myDialog.show();
    addWindowListener(new WindowAdapter() {
      public void windowClosed(WindowEvent e) { System.exit(0); }
  public static void main(String[] args) {
    Test test = new Test();
    test.setSize(100,100);
    test.show();
}

Similar Messages

  • 2nd Document window not closing

    I have 2 Document windows,
    - win1 is parent window.
    - win2 is a small window with 3 display fields
    and 2 buttons OK & Cancel.
    - other setting for 'win2' is
    Modal = 'YES'
    Close Allowed = 'YES'
    i have problem with Cancel button code, i am giving
    if :SYSTEM.EVENT_WINDOW = 'WIN2' then
    GO_ITEM('CTRL.FLD5');
    HIDE_Window('WIN2');
    end if;
    The WIN2 is not closing,
    i am calling this 'WIN2' from a WVI trigger of a field on parent window 'win1'
    by issuing SHow_WINDOW('win2') command.
    but it flashes error FRM-40737: illegal restricted Procedure SET_WINDOW_PROPERTY in WVI trigger.
    Any one please suggest. TY.

    hi Sarah,
    i dont to know to which item's WVI should i atttach this code.
    Since the window Closed_Allowed property is set "yes".
    the same code given at Form-level When-Widow-Closed, works well, closes the window in 1 click.
    but i dont know the same code given for Cancel button, does not close 'win2',
    One more point, first time when win2 is shown, that time, out of the [x] button on the status bar &
    Cancel button on win2, if i use [x] button first, then 'win2' closes and cursor is back in CTRL.FLD5 on 'win1', fair enough.
    then afterwards from CTRL.FLD5 when 'win2' is called again then the Cancel button code works fine just like the [x] button.
    but the question is why not first time, if i choose Cancel button first. why it is required [x] button to be used first.
    So the problems are;
    - FRM-40737 is thrown whenever win2 in invoked from CTRL.FLD5
    - 'WIN2' does not close by pressing Cancel button, when displayed first time.

  • How to make a frame window not resizeable

    I am working on a little chat programm in java and I have an AWT GUI. What I need to accomplish is to make the window not resizeable. I used a simple Layout and whenever the window is resized, all my buttons and textfields go fly around all over the place. So is there a command to unable resizing the window by the user ? Please answer fast, I need to get it done today, if possible ....

    Never mind folks, I allready solved the problem ....

  • 'Run' terminal window not closing

    I have an Java application which I have created an installation package for using InstallAnywhere.
    On Solaris when launching the application using the alias from a terminal window it works fine. But, when I launch the application from the File Manager, by double-clicking, it creates an 'extra' terminal window called 'Run', this terminal window doesn't terminate when I exit my application.
    How can I prevent this, can I prevent the 'Run' window from starting using some sort of setting, or can I somehow make sure it is closed togheter with the application?
    On Linux (SuSE10) the OS asks how I would like to run my application so I don't have the same problem there.

    Hi Kanwalpreet
    For basic idea please refer to the following link
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/dialog%20boxes%20in%20web%20dynpro%20applications.pdf">Dialog Boxes in WebDynpro</a>
    Go Through <b>page 16</b> of the PDF Document
    Regards
    Chaitanya.A

  • Window not closing

    In one of my views i have a button...when i press that a window opens up with a drop down list.......when i select a value from the drop down n press ok it throws an exception....
       com.sap.tc.webdynpro.services.exceptions.WDIllegalArgumentException: Tried to close window ID MPCELLJBfa title Select a Reason, but was not on top of the queue. Top window ID MPCEf7 title Docket Details!
        at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.popModalWindow(ApplicationWindow.java:161)
        at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.doClose(WebDynproWindow.java:398)
        at com.sap.tc.webdynpro.clientserver.window.Window.doClose(Window.java:153)
        at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.handle(ApplicationWindow.java:270)
        at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.handleWindowEvents(ApplicationWindow.java:237
    what cud b the way out...
    null

    Hi Kanwalpreet
    For basic idea please refer to the following link
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/dialog%20boxes%20in%20web%20dynpro%20applications.pdf">Dialog Boxes in WebDynpro</a>
    Go Through <b>page 16</b> of the PDF Document
    Regards
    Chaitanya.A

  • Jframe window not closing

    Hi can anyone plz tell me how i will close my jframe window..
    I have a button called EXIT,clicking which i want to close my Frame...
    I am writiing setvisible(false) but thats not working..

    use
    System.exit(0);
    All the best

  • Groups Window not closing like before update 4.3

    After the update to Android 4.3, group windows often don't close after you hit the home button to exit/switch apps.  This behavior is a little annoying.  Is this a bug or working as designed?
    After I switch apps using the home button, I expect the group window I used to launch an app to be closed...I don't expect to press the home button twice.

    If I'm understanding you correctly, I'm experiencing the same thing. It isn't a matter of specific apps, but of the way Android 4.3 now handles folders on Home screens. For instance, I have some folders on my Home screen with quick-dial links. I open the folder, tap a link, and it dials the contact. When I'm done and go back to my Home screen, there the folder is still open. The same thing happens with folders that have apps.
    This is a change made in Android 4.3 in comparison to earlier versions of Android. Many people have commented on this online, most of them as unhappy about it as you and I, kil. (E.g., this post and the ones following it in an Android Central thread.) Unfortunately, there's nothing that can be done about it. Maybe they'll change it back in the next version of Android, maybe not.

  • JPopupMenu in one frame is not closing while clicking on the another frame

    Hi friends,
    I have a web application which is manily applet oriented. I have two frames in the page on which i have loaded separate applets. One on the left side an the other on the right side. I have implemented a popup using JPopUpMenu in the left hand side applet in response to mouse pressed event. But when i am clicking on the right side frame which is having the other applet loaded the pop up still remains the same in the first frame. It's not going away. How can I solve this issue ?
    Pls help me out in this regard.
    The JRE used is JRE 1.4.2
    Regads
    AK

    If you dont find anything specific, a lot of the problems i
    encounter like this are because one little thing is spelled wrong.
    like it doesnt match whats in your php file, ect. my suggestion,
    though a long one, if you know its supposed to work, and theres no
    syntax error, re type it, not copy and paste, and just be careful.
    keep tripple checking. you might not even find what was spelled
    wrong, but it might fix the situation,

  • Windows not closing in safari

    whenever I use safari and try to close a window, the red x button does not work. What can I do? Please HELP ME!!!!!
    ibook g4   Mac OS X (10.4.5)  

    Hi hulkman,
    Have a search of the forums (search box in the top right hand corner of the window) - this issue has been mentioned a few times already so hopefully those posts will tell you how to fix things.

  • About window not closing

    When I go into the about window for Adobe Reader X it shows the relevant paces and I have version 10.1.11. I am then unable to close the window by selecting the red cross and the window just stays. The only way I can close the window is going into to taskmanager and closing the program

    YOUR RIGHT. Worked first time. Thanks
    On Wed, Sep 24, 2014 at 2:43 PM, Pat Willener <[email protected]>

  • Firefox.exe*32 not closing down when i sutdown all open windows so I have to close it through taskmanager

    firefox.exe*32 not closing down when i sutdown all open windows so I have to close it through taskmanager so I can then start a new session.

    See:
    *"Hang at exit": http://kb.mozillazine.org/Firefox_hangs
    *"Firefox hangs when you quit it": https://support.mozilla.org/kb/Firefox+hangs

  • Save As dialog box does not gain focus (bring to foreground) with Windows 7?

    Hello,
    I've got several users with Microsoft Windows 7 (64bit) and Adobe Acrobat 9 Standard (OEM) with the same problem.  When you go to Print to your PDF Printer, the Save As... dialog box does not come to the foreground and gain focus.  Most often it just sits in the taskbar blinking to get their attention.
    However the users get frustrated and often don't realize the Save As box popped up at all.  They did not have this problem with Windows XP.
    I actually can replicate the problem on my own PC.
    Any workarounds for this behaviour?
    Thanks,
    -Tim

    This appears to be a Windows 7 focus issue.
    You can back up your registry and try the fix below, it worked for me.
    Fix number 1
    1. Open Start >> Run and type “regedit” (without quotes)
    2. Navigate to the following path:
    [HKEY_CURRENT_USER\Control Panel\Desktop]
    3. Right Click on the empty space and create a new DWORD value, or modify the existing value named ‘ForegroundLockTimeout’, set or modify the value to 0. (this value will cause the application to take the focus instantly.)
    4. That’s it Done, exit registry and restart windows for changes to come into effect.

  • How to get the closing event (not closed) of Dialog control

    Hi All,
    I have one requirement, that I have to close the Dialog box in an animated way like on clicking of the Dialog close button the popup has to close from top to bottom in a slide effect.
    sap.ui.commons.Dialog
    When I tried closed method of Dialog, it is calling only after dialog box closed but, I need the closing event rather closed event.
    I am putting a UI5 view in Dialog as I need some custom/dynamic content in the dialog.
    Please suggest the solution for this.
    Thanks & Regards,
    Pavan Thirunamala,
    [Moderator Message - Please do not provide contact information like Phone Number etc in the discussion message. It has been removed.]
    Message was edited by: Chandrashekhar Mahajan

    JS Bin - Collaborative JavaScript Debugging&lt;/title&gt; &lt;link rel=&quot;alternate&quot; type=&quot;application/jso…
                sap.ui.getCore().getEventBus().subscribe("sap.ui","__beforePopupClose",
    function(channel, event, params)
      debugger;   
    $(params.domNode).animate({
                      opacity : 1,
                  height : 0

  • How do I selectivly close the only not responding window (without closing the other 3 responding windows)

    Presently, I have 4 windows opened, each with a bunch of tabs.
    Since I restarted firefox this morning, one out these 4 windows, keeps on not displaying.
    How do I selectivly close this only window (without closing the 3 others windows)

    Here is what the manpage shows:
    [ps(1)|http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/p s.1.html]
    state The state is given by a sequence of letters, for example, ``RWNA''. The first letter indicates the run
    state of the process:
    I Marks a process that is idle (sleeping for longer than about 20 seconds).
    R Marks a runnable process.
    S Marks a process that is sleeping for less than about 20 seconds.
    T Marks a stopped process.
    U Marks a process in uninterruptible wait.
    Z Marks a dead process (a ``zombie'').
    Additional characters after these, if any, indicate additional state information:
    + The process is in the foreground process group of its control terminal.
    < The process has raised CPU scheduling priority.
    <div class="jive-quote"> The process has specified a soft limit on memory requirements and is currently exceeding that
    limit; such a process is (necessarily) not swapped.
    A the process has asked for random page replacement (VA_ANOM, from vadvise(2), for example,
    lisp(1) in a garbage collect).
    E The process is trying to exit.
    L The process has pages locked in core (for example, for raw I/O).
    N The process has reduced CPU scheduling priority (see setpriority(2)).
    S The process has asked for FIFO page replacement (VA_SEQL, from vadvise(2), for example, a large
    image processing program using virtual memory to sequentially address voluminous data).
    s The process is a session leader.
    V The process is suspended during a vfork.
    W The process is swapped out.
    X The process is being traced or debugged.

  • How to fix alt f4 not closing window

    how to fix alt f4 not closing window if watching video unless you off click out of the video, does not happen in IE ?

    Add:
    $objForm.add_FormClosing({$_.Cancel=$true})
    [void] $objForm.ShowDialog()
    Add:
    $OKButton.Add_Click({$x=$objTextBox.Text;$objForm.Add_FormClosing({$_.Cancel=$false});$objForm.Close()})

Maybe you are looking for