Solved

A Dialog

Posted on 1998-11-14
5
236 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now