Results 1 to 3 of 3
  1. #1
    hannehomuth's Avatar
    hannehomuth is offline Member
    Join Date
    Jul 2008
    Location
    Sommerfeld (Brandenburg, Germany)
    Posts
    36
    Rep Power
    0

    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

    Java 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

    Java 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

  2. #2
    skaspersen is offline Member
    Join Date
    Jul 2008
    Posts
    31
    Rep Power
    0

    Default

    Java Code:
    public static void showDialog() {
        cfgView = new ConfigurationEditView(true);
        cfgView.setModal(true);
        cfgView.setVisible(true);
        System.out.println("Will not display until dialog closed");
    }

  3. #3
    hannehomuth's Avatar
    hannehomuth is offline Member
    Join Date
    Jul 2008
    Location
    Sommerfeld (Brandenburg, Germany)
    Posts
    36
    Rep Power
    0

Similar Threads

  1. What is the execution path of wait() and notify() ?
    By AegisCruiser in forum Threads and Synchronization
    Replies: 1
    Last Post: 04-23-2008, 06:16 PM
  2. How to use sleep() to wait for a while
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 06:32 PM
  3. Replies: 0
    Last Post: 02-16-2008, 09:29 PM
  4. Middle Click Closes Tab Eclipse Plugin 1.0.0
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-20-2007, 05:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •