Problem displaying my dialog box

Hi everyone.
I have a very annoying problem. I have a GUI frame that my application runs in. It implements a WindowListener interface and I override the windowClosing() method so when the window is closed I perform some memory clean up procedures.
So I want to have a dialog box pop up when the window is closing which displays some information about what's going on while my closing procedures are being executed.
The problem is that the dialog box appears, which I do by:
shutdownDialog.setVisible(true);but it has nothing in it. No components at all. Now I used Netbeans to make the dialog box so I know they should be there.
I even put the shutdownDialog.setVisible(true) into another part of my program and when the box pops up it has all the components like it should.
Is there a reason why components of the dialog box don't show up when it's called from the windowClosing() method?
Is there any other way I could accomplish that?

If the components don't appear possible causes could be: they haven't been added to the dialog, they haven't been laid out within the dialog, they aren't being painted.
Now I used Netbeans to make the dialog box so I know they should be there.It isn't my intention to stand between someone and their belief systems. But neither can I stand aside silent when I know that skepticism is more effective in tracking down bugs: abandon "they should be there" in favour of "they are not there" and try and figure out why.
I don't know Netbeans, but the following is effective:
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
public class CloseEg {
    private JFrame gui;
    public CloseEg() {
        gui = new JFrame("Close example");
        gui.setSize(new Dimension(300, 300));
        gui.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        gui.addWindowListener(appCloser);
        shutdownDialog = new JDialog((JFrame)null);
        shutdownDialog.setUndecorated(true);
        shutdownDialog.add(new JLabel("Close down initiated.  Please be patient"));
        shutdownDialog.setLocationRelativeTo(null);
        shutdownDialog.pack();
        gui.setVisible(true);
    private WindowListener appCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            shutdownDialog.setVisible(true);
            Thread closerThread = new Thread(new Runnable() {
                public void run() {
                    doCloseDown();
            closerThread.start();
    private JDialog shutdownDialog;
    private void doCloseDown() {
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        System.exit(0);
    public static void main(String args[]) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                new CloseEg();
}If I don't pack() the dialog, I don't see it at all. If I try and do the closedown on the EDT - ie don't create a new thread for it - then the sleep() (or other lengthy operation) stops the dialog's components from being drawn.
You will get better help more quickly in the [Swing forum|http://forums.sun.com/forum.jspa?forumID=57]. Although having started here, you might as well continue.
If nothing suggested by my code helps, you might like to post an example that can be compiled to illustrate the problem. (But teh Netbeans is a jealous god and sometimes makes that difficult;)

Similar Messages

  • Displaying a dialog box.

    I have to display a dialog box by using ADF faces. I am able to create a pop up, but need a dialog box in its place. Does anyone know how to accomplish this?
    thanks.
    Minaz.

    Hi Minaz!
    The Dialog Framework creates a popup window. In that window you can add 'normal' jsf pages (with or without workflow). The advantage is, that you have direct access to the values that you have put into tze dialog form. See that article: http://www.oracle.com/technology/products/jdev/101/howtos/adfdialog/index.html
    Claus

  • Displaying Common Dialog Boxes

    How can i display the Dialog boxes Open File / Save as... etc?
    I want to Show the dialog box Open File, then when the user closes the dialog the choosen file will be entered
    in a text item so that i can save it in a varchar table field.
    Thanks in advance

    Duncan
    I am surprised at you assuming Dimitris is developing for client server. Nobody is doing that any more, are they ?

  • Displaying my dialog box????

    Hi am try to display a dialogue box after a user has entered a value between 1-9 in a text field and has hit enter. The purpose of this dialogue box is merely a flag so that i know it is going into my statement. Code
    textField = new TextField(20); // public declaration
    textField.addKeyListener(new KeyCatcher() );
    m_nShapesToDraw = 0;
    public void itemStateChanged(ItemEvent evt)
    if ( evt.getItemSelectable() == m_oval ) {
    JOptionPane.showMessageDialog(this, "U selected the oval radio button.");
    m_bSelectOval = true;
    public class KeyCatcher extends KeyAdapter
    public void keyPressed(KeyEvent evt){
    int temp = evt.getKeyCode();
    if(m_nShapesToDraw == 0)
    if(m_bSelectOval || m_bSelectSquare || m_bSelectTriangle)
    if(( temp >= KeyEvent . VK_0 ) && ( temp <= KeyEvent . VK_9 ) && (temp == KeyEvent . VK_ENTER) )
    JOptionPane.showMessageDialog(this, "u hit enter.");
    When i run the above code i get the error message
    cannot find symbol showMessageDialoge(MainWindow.KeyCatcher,java.lang.String)
    The problem i am having is that when i try to insert the dialogu message code in my keyCatcher code i get that error. However, that code is the same exact code from the itemStatechanged method wich works. So my question is, y do i get this error even though it is taken from my itemstatched method and what must do to be able to display my message?? Thank
    Message was edited by:
    nvidia1

    Why are you using a JOptionPane it is a Swing component?
    All your other questions are relating to AWT components.
    Don't mix Swing and AWT components in the same application.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • Displaying Where Dialog Box in Forms 10g at runtime

    hi all,
    In Forms 6i, I was able to display the Where Dialog box to define complex search conditions by entering <b>:variable_name</b> in a field.
    How can I do the same in Oracle 10g Forms at runtime?
    thanks in advance.

    Have you had a look at metalink note 370302.1?
    Symptoms Query/Where dialog does not come up when execute query on block entering '&' or ':' in a field.
    ChangesUpgrade to Forms 10.1.2.0.2 Cause In order to be more secure out of the box, a new parameter was introduced
    FORMS_RESTRICT_ENTER_QUERY to TRUE in default.env and this results in the query/where dialog not appearing.
    SolutionTo implement the solution, please execute the following steps:
    1. Edit $ORACLE_HOME/forms/server/default.env
    2. Comment the line as :
    # FORMS_RESTRICT_ENTER_QUERY=TRUE
    or
    set:
    FORMS_RESTRICT_ENTER_QUERY=FALSE

  • Secure printing problems with the dialog box

    Hi!
    Some one which has problem with the scure dialog box then using secure printing?
    then we print in Adobe acrobat reader X 10.0.1 the dialog box for entring your pin nummer appearing under acrobat, causeing the program to locking until you go to the dialog box and clicking on it and enter the pin. The problem is that adobe not showing the dialog box in front of the printing overall dialog.
    had nog problem with the old 9, it started then we uppgraded. Haw tride a nother driver but haw same issue. And all other programs works greate, word, notepat etc so it is just Adobe that has the problem.. ?
    /J

    Hi!
    Its´s XP sp3 and the printer is a network printer(Toshiba e-studio 4520c)  running a PCL6 driver.
    Screen capture is not so much to see i think, running Swedish interface to. The ordinary dialogbox för printing is the first thing thats pops up, and then adobe reader frezes because the secund box pops up under adobe, you can click on it in the "toolbar" to continue. One thing that is diffrent when you print in adobe is that you can se on the "toolbar" for the popup box for the pin/password box is a Adobe icon on it. It is not so in example when printing in word, ie8 etc.
    The problem is that many users dont see it and thinks the program has stopt working.
    Im now going to try the PS driver from toshibas homepage..
    thanks for help!

  • How to display a dialog box?

    I finally have my application accepting data through a form and posting to a MySQL database.
    Now, when a record has been successfully posted to the database I would like a dialog box to appear saying "Data saved in database...click OK to continue" and the user clicks on the OK button and goes back to the front back of the application.
    How can I make a dialog box appear, or what are the alternatives (if this is not possible).
    Thanks,
    Peter

    Typically you would name each object in your user interface (the name is not necessarily the same as the visible text in the button, but it might be).
    Then the name of the button is passed into the on clicked handler where you can deal with it how you like:
    on clicked theObject
      if name of theObject = "button1name" then
        -- code to display your dialog
      else if name of theObject = "button2name"
        -- user clicked a different button, so that code goes here
      end if
    end clicked
    You can extend this to run any actions based on the object that was clicked.

  • Problem in modal dialog box

    Hello,
    I've created a function which call a modal dialog box. In this one, the user has to choose a value in a listbox. It's like a popup for the user.
    The screen is called like below:
    CALL SCREEN 0500 STARTING AT 5 5
                       ENDING   AT 100 10.
    The screen is defined with a pf-status containing only one icon(pf-key) with value VALID. In the process after input, I'm controlling the value like below:
    MODULE USER_COMMAND_0500 INPUT.
    data : save_ok like sy-ucomm.
    save_ok = lv_code.
      case save_ok.
        when  'VALID'.
          if lv_prio(2) lt 4.
            message s098(ze).
          else.
            set screen 0.
            leave screen.
          endif.
        when others.
        message s098(ze).
      endcase.
    ENDMODULE.                 " USER_COMMAND_0500  INPUT
    I have a bug when the program is calling twice the function means the popup.
    Instance of program Z.
    loop at X.
       call function YY.......
    endloop.
    The table X contain two values.
    When the popup is called the first time in the loop, all is ok, but when the popup is called the next time, if the user doesn't choose a value in the listbox and just press on the keyboard Enter, then the system go completly out of the program Z and doesn't go in the user_command !!!!
    I've defined the field (listbox) as required, but no effect.
    Is it a bug of the system ? or do I defined the screen incorrectly or ???
    Thanks a lot for your help.

    Hi merle,
    i  have u debugged the program ?  Is it coming to user-command event ?
    What is the type of this field lv_prio ?
    comment set screen 0  & use leave to screen 0
    if lv_prio(2) lt 4.
    message s098(ze).
    else.
    leave to screen 0.
    endif.

  • Problem in File dialog Box ,why it is hidden how to get it on top of sap

    It is hidden how to get it on top of sap

    I am having a similar problem. However, the fileDialog only shows up behind SAP occasionally. I am running each ona  separate thread and have tried passing a blank form as the parent (as was suggested), but the problem persists.
    private void ThreadMethod()
               Form1 f = new Form1();
                f.TopMost = true;
                f.ShowInTaskbar = true;
                System.Windows.Forms.OpenFileDialog op = new System.Windows.Forms.OpenFileDialog();
                op.InitialDirectory = "c:
                if (op.ShowDialog(f) == System.Windows.Forms.DialogResult.OK)
    This is called from a button click
    if (pVal.ItemUID == "BT00")
                        System.Threading.Thread newThread = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadMethod));
                        newThread.SetApartmentState(System.Threading.ApartmentState.STA);
                        newThread.Start();
    Anyone got ideas?

  • InternetErrorDlg WinInet API does not display credential dialog box for user in IE10 when proxy is set

    I have set proxy server in IE. I prompt user for credentials using InternetErrorDlg API. Prompt appears in IE 9 and below. In IE10 and IE11 prompt doesn't appear.
    Below is the code sample I have been using.
    DWORD dwStatusCode(0);
    DWORD dwStatusSize = sizeof(DWORD);
    DWORD headerIndex = 0;
    ::HttpQueryInfo(hRequest, HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_STATUS_CODE,&dwStatusCode, &dwStatusSize, &headerIndex);
    if (dwStatusCode == HTTP_STATUS_PROXY_AUTH_REQ)
    DWORD dwFlags = FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
    FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS |
    FLAGS_ERROR_UI_FLAGS_GENERATE_DATA;
    DWORD res =::InternetErrorDlg(GetDesktopWindow(), hRequest, ERROR_INTERNET_INCORRECT_PASSWORD, dwFlags, NULL);

    Refer to the document of InternetErrorDlg function
    https://msdn.microsoft.com/en-us/library/windows/desktop/aa384694(v=vs.85).aspx
    What is the error code returned by InternetErrorDlg function?
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Can we display GUI windows/dialog boxes from two asynchronus threads?

    Hi All,
    I'm facing a problem with asynchronous threads. I've a client-server application where client is a Java application and server is a C++ application running on UNIX m/c. The C++ server is implemented equivalent to a HTTP server which handles the HTTP requests from the java client. So, whenever user select some action on the Java client, say "File/Open" menu, the client sends the equivalent HTTP request to the server, and waits for the response back from the server, and after getting the response displays it on the GUI.
    So far the java client application is single-threaded, and the communication between client-server was only one-way, i.e. all the communication was always initiated by the client.
    We had to change this behavior to make it multi-threaded, or rather two-way communication where kernel while processing any client request might need some response from the GUI. So, we had to create a ServerSocket on java client side, and C++ server is connected to this socket. So, whenever C++ server has to send some message to the GUI, it can send thru this other socket.
    On the java side, it's listening at this ServerSocket port in a separate thread, whenever it receives any request, it has to display a dialog box based on the request.
    Here is my problem coming. The main application thread (which is an AWT-EVENT- thread) has made a http request to the kernel and is blocked until it gets the response back, and in the mean time, the C++ server has sent a message to the GUI thru the other socket, and when I use JOptionPane.showOptionDialog(...), I see the dialog box outline but not the contents, and the same for my main application window.
    So main question here is, can I invoke, say,
    JOptionPane.showOptionDialog(...) on another thread, when the main application thread (rather AWT-EVENT -QUEUE thread) is blocked.
    Please let me know if anyone knows the answer or if has faced the similar problem. It will be a big help.
    thanks,
    Ajay

    You mean to make the HTTP request in a separate thread, like below,
    new Thread ( new Runnable() {
    public void run() {
    server.makeHTTPRequest(...);
    }).start();
    But we cannot do this, as there is one more constraint with our application, that it has to behave like single-threaded from user's perspective. i.e. If user has clicked "File/Open" menu, user has to wait until the "File/Open" action is completed. He cannot do anything in between.
    But if the server sends some message thru the other socket, then it has to displayed, and whatever user select on that dialog box, has to be sent to the server thry the same socket.
    I'm not sure whether this possible.
    Here is what I tried to make the http request in a separate thread, and at the same time, keeping the main thread in a wait state until the thread completes:
    new Thread (new Runnable() {
    public void run() {
    synchronized(server) {
    server.makeHTTPRequest(...);
    server.notify();
    }).start();
    synchronized(server) {
    server.wait();
    Even by doing the above it doesn't work, the GUI just hangs. I think the above code is effectively the same as,invoking directly,
    server.makeHTTPRequest(...);
    All I know is it's quite confusing. Does anyone has insight into it.
    thanks,
    Ajay

  • AppleScript Newbie - Display dialog box when quitting an application

    Hello.
    I was wondering if it's possible to write a script that displays a dialog box (in this case one saying "BACK UP!!!!") everytime i quit Final Draft.
    Thanks.
    F.

    A regular AppleScript does not have the ability to get system notifications, so you would have to do something like have the script continually check (poll) for applications that are running.  A Cocoa-AppleScript does have the ability to do Cocoa-y stuff such as register for system notifications, so you can create a new applet (AppleScript Editor > File > New from Template > Cocoa-AppleScript Applet), paste in the following, and save it as an application (uncheck the option to show the startup screen):
    property theApps : {"Final Draft"} -- a list of applications to watch for
    on run -- example
      # add observers for workspace notifications
      tell current application's NSWorkspace's sharedWorkspace's notificationCenter
        addObserver_selector_name_object_(me, "appQuit:", current application's NSWorkspaceDidTerminateApplicationNotification, missing value)
      end tell
      -- tell application "Final Draft" to activate
    end run
    on appQuit_(aNotification) -- an application quit
      # aNotification's userInfo record contains an NSRunningApplication instance that we can get properties from
      set theApplication to (aNotification's userInfo's NSWorkspaceApplicationKey's localizedName()) as text
      if theApplication is in theApps then
      tell current application -- me
        beep 3
        activate -- make sure dialog comes to front
        display dialog "BACK UP!!!!" with title "Final Draft quit notice" buttons {"OK"} default button 1
        quit
      end tell
      end if
    end appQuit_
    When the application is run it will sit there and receive notifications when other applications quit, and checks to see if it was the application you want.

  • Wizard Dialog  Box Problems - Screen Redraws

    I've encountered a frequently occurring problem with JDev dialog boxes. After launching and entering into a wizard, the
    dialog boxes do not draw correctly on my screen. For example, if I try using the Create Table Wizard, the input boxes for the table name,datatype, etc.. become a jumbled mess on the screen. I've tried re-sizing the dialog box and this has worked to some degree, but sadly in most cases it doesn't help. I don't think (although it's possible) that it's a bug on my computer.
    Any ideas? Workarounds? Solutions?

    Personally I would recommend against using JDK 1.4, either to run JDeveloper itself with, or to simply run your projects with.
    I've experienced some problems with that version, while the default 1.3.x works just fine. Problems range from minor GUI glitches to complete deadlocks in JClient applications.

  • Labview pauses when dialog box displayed

    When I display a dialog box in LabView, the program waits for the user to click ok. I would like for the program to not wait but keep running after it displays the box. How can I do this and how can I customize the dialog box?

    You drop an Invoke Node from the Application palette onto the block diagram, wire up a reference to the subVI, right click the invoke node and select the method. There's an example here that shows how an invoke node is used to make a front panel visible. There are other examples on the developer zone and several have been posted to this forum. You question seems to pop up once week or so and a little searching of the forum will give you a lot of examples.

  • How can I disable "download error" dialog box when saving a complete web page?

    Sometimes, when I try to save a web page as type: "Web Page, complete", firefox displays download error dialog box stating a file "could not be saved, because the source file could not be read."
    I don't have a problem with firefox couldn't save that file, but I have a problem with firefox displaying that dialog box, because I have to click OK everytime.
    Is there a way to disable that annoying dialog box?

    I modified the host file mainly to block ads. But that's not the problem. It's OK for me for firefox to not saving some parts of a page (ads usually within a frame). It's my intention to NOT saving those files. I just want to save the main content of a webpage.
    But I'm having a problem with firefox displaying the dialog boxes.

Maybe you are looking for

  • Auto provisioning for AD is not working in oim11gr2

    Hi All, I have current environment as OIM 11.1.2.0.7 and AD connector MSFT_AD_Base_11.1.1.5.0 with patch applied 14190610 and Connector_Server_111200 I configured an auto provisioning to AD I created an access policy based on a role MSAD Users. i am

  • Unwanted blank lines inserted into the page bean

    For some reason after using the visual editor and then switching to the java view, I notice that there are extra blank lines inserted between lines in the file. The extra lines can accumulate making the file very large and unusable. This has only sta

  • Credit Limit related Issue

    The problem i am facing is that any amount received from the customer as security deposit or down payment  is treated in SAP as specialGL transaction and it is not captured by the system for the purpose of Credit Limit Check . Since there is no credi

  • No "create new swatch" command

    I just noticed that there are no icon buttons at the bottom of the swatches panel to create or delete a new swatch like there is in AI and PS; is this an oversight?

  • Help! Executing SQL from ASP

    This is my Code.. Set OraSession = CreateObject("OracleInProcServer.XOraSession") Set OraDatabase = OraSession.DbOpenDatabase(strDB, strID & "/" & strPASS, 0) OraDatabase.DbExecuteSQL("DELETE tmp_clean;") It then runs a SQL statement which populates