Solved

A Dialog

Posted on 1998-11-14
5
249 Views
Last Modified: 2010-03-30
When a user clicks a button, a dialog is shown. I don't
want to let the user do anything on the parent frame before
the user closes the dialog. What should I do?
Please also lock the following question:
http://www.experts-exchange.com/topics/bin/Q.10097531

Thank!
0
Comment
Question by:leeann
  • 2
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
conick earned 0 total points
ID: 1227427
you need to make the dialog "modal"

you can do this with the Dialog constructor when you open your dialog
like this:

Dialog dlg= new Dialog(owner_frame,true);

Let me know if you need more information


0
 
LVL 7

Expert Comment

by:conick
ID: 1227428
you can also set a dialog "modal" that is already up by calling the method:

dlg.setModal(true);

0
 

Author Comment

by:leeann
ID: 1227429
Hi, Conick:
I have tried your codes, but I found there was a problem. Here is a piece
of my codes:
 public void actionPerformed(ActionEvent e)
     {  
        if (e.getSource() == btnCustom){
           //QueryDialog extends Dialog
            QueryDialog queryd = new QueryDialog(this,true);                    
            queryd.setModal(true);
            queryd.show();
            try{
               doQuery();
               more = rs.next();
               if(more)
                  showResultSet(rs, queryd);  //displays the  rs on the text area
                                                                       // in the QueryDialog queryd        
             }catch(Exception ex){
               System.out.println(ex);
            }
                       
         }
   }

The above codes looks work, but it can not display the result set rs of a
SQL on the text area in the QueryDialog queryd. If I put the code:
    queryd.setModal(true);  after the code:  queryd.show();  , It can not
display the result set rs of a SQL on the text area in the QueryDialog
queryd, but the user can do anything on the parent frame before
closes the dialog. Could you please tell me how to solve this problem?  
           

0
 

Author Comment

by:leeann
ID: 1227430
Sorry, I make a mistake in the last comment. It should be:
 If I put the code:  queryd.setModal(true);  after the code:  queryd.show();  , It can display the result set rs of a SQL on the text area in the QueryDialog
queryd, but the user can do anything on the parent frame before closes the dialog.   
           
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227431
maybe its better to put all the following code inside the Dialog class
and from outside just call queryd.setModal(true);

    try{
                     doQuery();
                     more = rs.next();
                     if(more)
                        showResultSet(rs, queryd);  //displays the  rs on the text area
                                                                             // in the QueryDialog queryd        
                   }catch(Exception ex){
                     System.out.println(ex);
                  }


0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate insert example 13 34
type mismatch (Object[] to double[] 4 33
iterator/ListIterator approach 17 39
Need Help! Getting a syntax error and don't understand why 3 31
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question