Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

A Dialog

Posted on 1998-11-14
5
Medium Priority
?
269 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

722 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