Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-24-2008, 02:31 PM
hannehomuth's Avatar
Member
 
Join Date: Jul 2008
Location: Sommerfeld (Brandenburg, Germany)
Posts: 35
Rep Power: 0
hannehomuth is on a distinguished road
Default [SOLVED] Application should wait until a Dialog closes
Hi Forum,

I have such a silly question, and I think it will be documented anywhere but I did not find anything. I have a JDialog class and I want that my application should wait to execute until this Dialog closes or set any variable to true. I think this is not so hard but I can't get along with that. Here Some Code

Code:
public class ConfigurationEditView extends javax.swing.JDialog{

...
...
...

 public ConfigurationEditView(boolean first) {
        super(new JFrame(), false);
        initComponents();

    }


 public static void showDialog() {

        Runnable view = new Runnable() {

            public void run() {
                ConfigurationEditView cfgView = new ConfigurationEditView(true);
                cfgView.setVisible(true);
                cfgView.toFront();
            }
        };
        
        Thread nThread = new Thread(view);
        nThread.start();
        //SwingUtilities.invokeLater(view);
    }

...
...
...
}
And here the call

Code:
ConfigurationEditView.showDialog();
Can somebody give me a good example that my application (GUI App) not go on until the call
ConfigurationEditView.showDialog();
has returned.

I've tried with a boolean variable in a while loop but that also did'nt work.

Thx for suggestions
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-24-2008, 02:44 PM
Member
 
Join Date: Jul 2008
Posts: 31
Rep Power: 0
skaspersen is on a distinguished road
Default
Code:
public static void showDialog() {
    cfgView = new ConfigurationEditView(true);
    cfgView.setModal(true);
    cfgView.setVisible(true);
    System.out.println("Will not display until dialog closed");
}
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-24-2008, 02:51 PM
hannehomuth's Avatar
Member
 
Join Date: Jul 2008
Location: Sommerfeld (Brandenburg, Germany)
Posts: 35
Rep Power: 0
hannehomuth is on a distinguished road
Default
Thank you, it works.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the execution path of wait() and notify() ? AegisCruiser Threads and Synchronization 1 04-23-2008 06:16 PM
How to use sleep() to wait for a while Java Tip java.lang 0 04-09-2008 06:32 PM
Launching an application from another application using thread Java Tip Java Tips 0 02-16-2008 09:29 PM
Middle Click Closes Tab Eclipse Plugin 1.0.0 JavaBean Java Announcements 0 10-20-2007 05:59 PM


All times are GMT +2. The time now is 04:09 PM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org