Make jFrame wait for jDialog to finish

I am making a project in Netbeans i have a main Frame and some Dialog windows that open up if you press some buttons.
when one window opens i want the main Frame script to pause and wait for it to complete.
i have tried 3 different ways:
questionDialog.setVisible(true);
while (questionDialog.isVisible()) {
    try {
        Thread.sleep(200);
    } catch (Exception e) {
} but that shows the frame of the dialog box but never loads the inside and the whole application freezes.
java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
        questionDialog.setVisible(true);
while (questionDialog.isVisible()) {
    try {
        Thread.sleep(200);
    } catch (Exception e) {
}that loaded my Dialog box but the script never waits for it to close i assume it is because it waits until "later" to show the dialog box and in that time it skips the while loop.
Thread t = new Thread(new Runnable() {
    public void run() {
        questionDialog.setVisible(true);
        while (questionDialog.isVisible()) {
            try {
                Thread.sleep(200);
            } catch (Exception e) {
t.start();
System.out.println("Dialog started");
System.out.println(questionDialog.isVisible());
try {
    t.join();
} catch (Exception e) {
}but that had the same result as the first code it waited but never showed the dialog.
where am i going wrong how should i go about this?
Scott.
EDIT:
by finish i mean become not Visible. so isVisible() will return false
Edited by: ratcateme on Nov 20, 2008 3:02 PM

You don't have to do anything to do that
questionDialog.setVisible(true), this method will block the thread, it would't keep going until the questionDialog is unvisible, this is the mistake of the way 1 and way 3.
and the way 2: the while block will be execute before the questionDialog.setVisible(true) is execute, so questionDialog.isVisible() will return false
my en is very poor, good luck!

Similar Messages

  • Update of jlabel does not happen when i wait for thread to finish (join())

    gurus please help.
    I have a main application which in actionevent calls a thread, that thread calls parent method to update ths status in jlabel, but when i use thread.join() to wait for process to complete, the jlabel does not get updated, please tell me how can i update the jlabel, i have to wait for thread to finish and during run i need to update the jlabel.
    thanks

    hi camickr and gurus:
    here is the code:
    notice after pressing the Process button, the label is being updated but its not working. I called the processnow() method directly and also by thread, but in thread I have to wait until it finishes using join() but still does not work, please help. Thanks
    package label;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.text.*;
    import javax.swing.border.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    public class thePanel extends JDialog {
      private DefaultTableModel tableModel = null;
      private JTable theTable = new JTable();
      private JScrollPane scrollPane = new JScrollPane();
    JPanel tPanel = new JPanel();
      private Border mainBorder;
      private BorderLayout borderLayout1 = new BorderLayout();
      private BorderLayout borderLayout2 = new BorderLayout();
      private BorderLayout borderLayout3 = new BorderLayout();
      private BorderLayout borderLayout4 = new BorderLayout();
      private JPanel statusPanel = new JPanel();
      private JPanel buttonPanel = new JPanel();
      private JPanel lowerPanel = new JPanel();
      private JLabel statusBar = new JLabel();
      private JButton processButton = new JButton("Process");
      public JButton closeButton = new JButton("Close");
      boolean image = true;
      theProcess processThread;
      Vector tableData = new Vector();
      ImageIcon Image = new ImageIcon("image.gif");
      ImageIcon oImage= new ImageIcon("oimage.gif");
      boolean errorOcurred=false;
      String statusMessage;
      public thePanel() {
        try {
         jbInit();
        } catch(Exception e) {
          e.printStackTrace();
      private void jbInit() throws Exception {
        tPanel.setPreferredSize(new Dimension(800,424));
        mainBorder = new TitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)," ");
        statusPanel.setBorder(BorderFactory.createEtchedBorder());
        tPanel.setBorder(mainBorder);
        tPanel.setLayout(borderLayout1);
        scrollPane.getViewport().add(theTable, null);
        tPanel.add(scrollPane,  BorderLayout.CENTER);
        // status
        statusPanel.setLayout(borderLayout2);
        statusPanel.setBorder(BorderFactory.createEmptyBorder());
        statusBar.setAlignmentX((float) 0.5);
        statusBar.setBorder(BorderFactory.createLoweredBevelBorder());
        statusBar.setMaximumSize(new Dimension(600, 21));
        statusBar.setMinimumSize(new Dimension(600, 21));
        statusBar.setPreferredSize(new Dimension(600, 21));
        statusPanel.add(statusBar, BorderLayout.SOUTH);
        // buttons
        processButton.setPreferredSize(new Dimension(70,25));
        processButton.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            process_actionPerformed(e);
        closeButton.setPreferredSize(new Dimension(70,25));
        buttonPanel.setLayout(borderLayout3);
        buttonPanel.setBorder(BorderFactory.createRaisedBevelBorder());
        buttonPanel.add(processButton,BorderLayout.WEST);
        buttonPanel.add(new JPanel());
        buttonPanel.add(closeButton,BorderLayout.EAST);
        // lower panel
        lowerPanel.setLayout(borderLayout4);
        lowerPanel.setBorder(BorderFactory.createEmptyBorder());
        lowerPanel.add(statusPanel, BorderLayout.WEST);
        lowerPanel.add(buttonPanel, BorderLayout.EAST);
        tPanel.add(lowerPanel, BorderLayout.SOUTH);
        theTable.setAutoCreateColumnsFromModel(true);
        theTable.setColumnSelectionAllowed(false);
        theTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        theTable.getTableHeader().setReorderingAllowed(false);
    getContentPane().add(tPanel);pack();
        getinfo();
    show();
      private void prepairTable(){
        tableModel = new DefaultTableModel(){
                          public boolean isCellEditable(int row, int col)
                            { return false; }};
        tableModel.addColumn("text 1");
        tableModel.addColumn("text 2");
        tableModel.addColumn("text 3");
        tableModel.addColumn("text 4");
        tableModel.addColumn("text 5");
        theTable.setModel(tableModel);
      } // end method (prepairTable)
      public void refreshTable() {
        prepairTable();
      public void getinfo() {
        try {
            refreshTable();
            tableModel.addRow(new Object[]{"3465465555","0123456789",new Date(1135022905196L),"0100000","errror message","sssssss"});
            tableModel.addRow(new Object[]{"8949344562","0324354549",new Date(1134511763683L),"0166600","errror mes666e","ddddddd"});
    setStatusMessage("ready to process, select record and click Process button to process record");
          errorOcurred = false;
        } catch (Exception ex) {
          errorOcurred = true;
          ex.printStackTrace();
        } // End try
      private void process_actionPerformed(ActionEvent e) {
        try {
          if(theTable.getSelectedRows().length > 0) {
    //        processThread = null;
    //        processThread = new theProcess(this);
    //        processThread.start();
    processnow();
            System.out.println("........finished now.........");
          } else {
        } catch (Exception ex) {
          ex.printStackTrace();
      public void processnow() {
        try {
          int[] selectedRows = null;
          int totalSelected = 0;
          setStatusMessage("processing " + totalSelected + " selected records...");Thread.sleep(1500);
          selectedRows = theTable.getSelectedRows();
          totalSelected = selectedRows.length;
          for(int i = 0; i < totalSelected ; i++){
            setStatusMessage("processing " + (i+1) + " of " + totalSelected + " selected records...");
            System.out.println(".......................row: "+selectedRows);
    Thread.sleep(2500);
    System.out.println("........fins...........");
    errorOcurred = false;
    } catch (Exception ex) {
    errorOcurred = true;
    ex.printStackTrace();
    } // End try
    public void setStatusMessage(String message) {
    statusMessage=message;
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    if(image)
    statusBar.setIcon(Image);
    else
    statusBar.setIcon(oImage);
    statusBar.setText(statusMessage);
    statusBar.update(statusBar.getGraphics());
    public static void main(String[] args){
    new thePanel();
    } // class
    package label;
    import java.lang.Runnable;
    public class theProcess implements Runnable {
    private thePanel parent;
    public theProcess(thePanel xparent){
    parent = xparent;
    } // end constructor
    public void start() {
    try {
    Thread thisThread = new Thread(this);
    thisThread.start();
    thisThread.join();
    } catch(Exception ex) {
    ex.printStackTrace();
    } // end method (start)
    public void run(){
    try {
    parent.processnow();
    } catch (Exception ex){
    ex.printStackTrace();
    } // end try
    } // end method (run)
    } // end class

  • I just want to share my experience or rather terrible experience with apple service.....I am soooo disappointed with the apple customer service at the local store in Tampa......every time they give u an appointment and make people wait for hours......ther

    I am soooo disappointed with the apple customer service at the local store in Tampa......every time they give u an appointment and make people wait for hours......there was some cosmetic problems with the screen of my Mac book pro....they replaced it but the computer would not turn on....and btw when I went to pick up my computer the representative handover my computer to another guy without checking his id who was there to pick up his phone.......then I had to take it back second time this time they messed up my iWork...I took it back but they couldn't retrieve my history of purchase of iWork...and then when I installed the iWork at home...none of the applications is working.... .I will have to take is back fourth time.....I loved apple products but may be not anymore.......

    Other than what Shotist007's remarks (which solves nothing) your experience is not common. First I would speak to the store manager to get things rectified for you. If that doesn't work out then I would contact AppleCare and speak to a customer service representative and complain via that venue.

  • 10g: Cube  build performance:Waiting for tasks to finish

    I had a question related to cube build performance. We see the following in the OLAPSYS.XML_LOAD_LOG prior to completion of parallel processing. So basically the loading of records etc. happens in 2-3 mins but then the part for "running jobs and started 6 finished 5 out of 6 tasks takes almost 30-40 minutes to complete". At this point in background it invokes the xmlloader and xml_parallel_loader. Any insights as to what specifically this steps do (solving of measures etc.) ? Also what we need to modify in terms of xml tag or anything else to improve these timings?
    14:10:56 Started 6 Finished 5 out of 6 Tasks.
    14:10:56 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:01:04 Started Auto Solve for Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition.
    14:01:04 Finished Load of Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition. Processed 189616 Records. Rejected 0 Records.
    Thanks,
    Sudip

    When we checked the scheduler jobs we saw xmlparallel_loader. in terms of v$session_wait we saw a db file sequential read. Following is a snapshot from the stage of finished updating partitions to starting of parallel load. Please advise.
    XML_MESSAGE
    14:49:12 Completed Build(Refresh) of AWM_CR2.CRICUBE Analytic Workspace.
    14:49:12 Finished Parallel Processing.
    14:49:10 Finished Auto Solve for Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition.
    14:40:59 Started 6 Finished 5 out of 6 Tasks.
    14:40:59 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:30:58 Started 6 Finished 5 out of 6 Tasks.
    14:30:58 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:20:57 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:20:57 Started 6 Finished 5 out of 6 Tasks.
    14:10:56 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:10:56 Started 6 Finished 5 out of 6 Tasks.
    14:01:04 Started Auto Solve for Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition.
    14:01:04 Finished Load of Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition. Processed 189616 Records. Rejected 0 Records.
    14:01:02 Finished Auto Solve for Measures: TOT_AMT from Cube CR_BASE_FIN.CUBE. 2008 Partition.
    14:01:00 Finished Load of Measures: TOT_AMT from Cube CR_BASE_FIN.CUBE. 2008 Partition. Processed 1494 Records. Rejected 0 Records.
    14:01:00 Finished Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_OSUC.CUBE. 200901 Partition.
    14:01:00 Started Auto Solve for Measures: TOT_AMT from Cube CR_BASE_FIN.CUBE. 2008 Partition.
    14:01:00 Finished Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_ENR.CUBE. 200901 Partition.
    14:01:00 Finished Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_FIN.CUBE. 200901 Partition.
    14:01:00 Finished Auto Solve for Measures: TOT_AMT from Cube CR_BASE_ENR.CUBE. 2008 Partition.
    14:00:58 Finished Load of Measures: TOT_AMT from Cube CR_CURR1_FIN.CUBE. 200901 Partition. Processed 1494 Records. Rejected 0 Records.
    14:00:58 Started Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_FIN.CUBE. 200901 Partition.
    14:00:58 Finished Load of Measures: TOT_AMT from Cube CR_BASE_ENR.CUBE. 2008 Partition. Processed 1577 Records. Rejected 0 Records.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_CURR1_OSUC.CUBE. 200901 Partition.
    14:00:58 Finished Load of Measures: TOT_AMT from Cube CR_CURR1_OSUC.CUBE. 200901 Partition. Processed 4521 Records. Rejected 0 Records.
    14:00:58 Started Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_OSUC.CUBE. 200901 Partition.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_CURR1_FIN.CUBE. 200901 Partition.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_BASE_ENR.CUBE. 2008 Partition.
    14:00:58 Started Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_ENR.CUBE. 200901 Partition.
    14:00:58 Finished Load of Measures: TOT_AMT from Cube CR_CURR1_ENR.CUBE. 200901 Partition. Processed 1577 Records. Rejected 0 Records.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_CURR1_ENR.CUBE. 200901 Partition.
    14:00:58 Started Auto Solve for Measures: TOT_AMT from Cube CR_BASE_ENR.CUBE. 2008 Partition.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_BASE_FIN.CUBE. 2008 Partition.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872, AWXML$_4361_77873.
    14:00:55 Started 4 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872, AWXML$_4361_77873, AWXML$_4361_77874.
    14:00:55 Started 6 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872, AWXML$_4361_77873, AWXML$_4361_77874, AWXML$_4361_77875.
    14:00:55 Started 6 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872, AWXML$_4361_77873, AWXML$_4361_77874, AWXML$_4361_77875. Waiting for Tasks to Finish...
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872.
    14:00:55 Started 3 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871.
    14:00:55 Started 2 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870.
    14:00:55 Started 1 Finished 0 out of 6 Tasks.
    14:00:55 Starting Parallel Processing.
    14:00:55 Detached AW AWM_CR2.CRICUBE.
    14:00:55 Started 5 Finished 0 out of 6 Tasks.
    14:00:22 Finished Updating Partitions.

  • NI Scope Wait for Acquisition to Finish Obselete in 2014

    Quick Question,
    In LabVIEW 2014, the NI scope Wait for Acquisition to Finish subVI is no longer used and is obsolete apparently, can some one tell me why this is and what I can use instead with the new 2014 NI scope blocks? 
    Thanks for your help!

    Query Acquisition Status until Status is "Complete"  To avoid infiate loops (missing trigger event) you should set a Timeout for the loop
    Alternately use hardwae and rout the End of Acquisition event to something
    Jeff

  • Second tween does not wait for first to finish

    Having a little problem here and as far as I can tell it is
    just that the second tween starts before waiting for the first to
    finish. Basically on a click event it should slide out a scroll
    pane to the bottom of the screen, change the contentpath of the
    scroll pane, then slide it back up.
    with the code below it just slides up the new movie clip but
    does not slide out the old one, if i remove the code for the new
    clip to slide up the old one does do the slide out how I want it to
    look.
    how can I make a pause in between the two to wait.
    on (press) {
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    _root.mask._x = 54;
    _root.mask._y = 109.3;
    _root.scroll_pane.setMask(_root.mask);
    switch (_root.loaded_clip)
    case 2: var Slide_out:Tween = new Tween(_root.scroll_pane,
    "_y", Bounce.easeOut, _root.scroll_pane._y, 900, 3, true); break;
    _root.scroll_pane.contentPath = "Search_mc";
    var Slide_up:Tween = new Tween(_root.scroll_pane, "_y",
    Bounce.easeOut, 900, 109, 3, true);
    _root.loaded_clip = 1;
    }

    Its still not working with that code but I think I can muck
    around with it and figure it out, the slide out works on the old
    clip now but then the new one never shows up.
    The onMotionFinished was basically what I was looking for,
    think I can eventually figure it out from here, thanks for the
    info.

  • Hp34970a read vi doesnot wait for scan to finish

    hi all.... i am facing problem ..im tryin to read DC current values from two channels.. i modified the advanced scan vi example..
    the read
    vi is not waiting for the scan to finish.... i used trigger vi outside
    a for loop and i want the readings to be taken for a number of times
    which is equal to the trigger count.... i even placed a time delay
    between the standard event vi and the read vi....the standard event
    register vi has been set for operation complete bit. Yet the read vi is
    not waiting.
    so can anyone let me knw if the delay helps in waiting the read vi to finish the scan??
    will the read vi give out the readings for each scan or will it just display random values??
    im
    posting the vi here... i kept the scan count to be 15 and scan-scan
    interval as 1sec. ( so it implies that im using a timer source for
    triggering) I used a time delay of 0.9secs in between standard event
    register vi and the read vi. 
    i used a for loop insted of
    a while loop coz i need the number of readings = scan count. i placed
    the trigger vi outside the for loop.
    can anyone have a look over this vi and help me out?
    Attachments:
    final2.vi ‏59 KB

    Now I placed a while loop around the standard event register vi and i am running it till i get a true in the bits set output. this time i checked the parameter'operation complete bit' instead of setting it. Only then i can see true value on the bit set output or else false.
    The bit 1 is true after some time (after scanning is done), but the instrument is showing -410 error. This error actually says ' a command was received which sends data to the output buffer, but the ouput buffer contained data from previous command(previous data is not overwritten).The output buffer is cleared when power has been off or after a bus Device Clear.'
    What should i do? Can you tell whether what i did is right? I atached the vi which has while loop around the standard event register vi.
    Attachments:
    final3.vi ‏49 KB

  • Wait for commit to finish

    Hello,
    I am calling a standard function that update some tables and at the end execute a commit work without the wait clause, but right after the execution of the standard function I need to perform some operations that needs all the tables to be updated, so unfortunatelly I needed commit work and wait inside the standard function.
    As I cannot change the standard function I tried to use table VBHDR to check when the update process finish but I noticed in my system this table is not trustfull as there are lots of garbage there with field VBRC = 1.
    So my question is how can I wait for the commit work to finish in this situation?
    Regards,
    Mauricio

    well this a random approach but u can try this.
    use WAIT UP TO n seconds give the vales as some 120 or 180 seconds.
    but u cant be sure if its stable all the time.
    Or u can try and call the function with the addition IN UPDATE TASK
    кu03B1ятu03B9к
    Edited by: kartik tarla on Jan 5, 2009 6:41 PM

  • Quiz slide waits for Audio to finish before proceeding to next question

    Hi guys, hope you can help. I have 5 questions with audio inside narrating the question and the answer in selection. Once you you have chosend your answer then click submit button..it waits until the audio finishes then proceeds to the next question.
    hope you can help
    Thank you

    Having this action on Slide Exit of the Quiz Results slide may not work if the user clicks a button there to Review Quiz because that will mean that the last frame of the Quiz Results slide doesn't get played.
    There is an internal Captivate system variable that gets set on each question slide when it's in Review Mode, but I don't think you can read this variable via Advanced Actions.  If you could read it, you could check it and then trigger the mute action on Slide Enter of each question slide.
    UPDATE: Just thought of another possible workaround.  There's a system variable called cpInfoPrevSlide that records the last slide you visited before the current one.  You could use this in a conditional action to trigger cpCmndMute.  When the user clicks Review Quiz on the Quiz Results slide it will take them back to the first scoring object in the Quiz Scope. OnSlideEnter of this slide you need to check whether or not cpInfoPrevSlide is the Quiz Results slide, and if it is, set cpCmndMute to 1.  That should turn off the audio on the slides from then on.
    For instruction audio on the Quiz Results slide I prefer to have the audio attached to a rollover caption.  That way, the user only gets the audio if they explicitly roll over the HELP button (or whatever you call it).

  • Automator doesn't wait for app to finish launching.

    During "watch me do" actions that lauch an app Automator does not wait for the app to launch. This seems like a bug since Automator does infact know it is launching an app, this shouldn't be something that should require a sleep every time.

    Did you try one these actions?

  • HT1212 My iPad was locked & disabled & tried every possible way to restore but nothing is working - After select Restore, & waited for updates to finish, gets iPad Cannot be resotred at this time because server could not be contacted - Pls help

    Friends,
    My iPad2 was locked and disabled because my kids entered several times the passcode and now it is locked. I tried every possible ways and read all related items and followed precisely articel http://support.apple.com/kb/HT1212 but after i restored and update teh iPad, itunes keeps giveing me the same message:
    The iPad "iPad" cannot be restored at this time because the iPad software update server could not becontacted or is temporarily unavailable.
    I tired at different time of teh day and noght and different days yet kept getting the same message.
    Pls assist me as now the iPad is useless
    Regards,
    Joe

    If reset doesn't work, try and force the iPad into Recovery Mode.
    Recovery Mode
    1. Disconnect the USB cable from the device, but leave the other end of the cable connected to your computer's USB port.
    2. Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to turn off.
    3.While pressing and holding the Home button, reconnect the USB cable to the device. The device should turn on.
    4. Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears, release the Home button. iTunes should alert you that it has detected a device in recovery mode. Click OK, and then click Restore to restore the device.
    Note: Data will be lost. You may have to repeat the above many times.

  • How do i make program wait for user input in some dialog box?

    basicly function public UserData getUserData()
    displays window and returns a value when somebody has pressed OK in JFrame. How?

    Extend from JDialog instead of JFrame and it'll give you the waiting that you need.
    To use a JFrame is a little more involved.
    I had to the other day also. I wanted to have a dialog that would be both a dialog and a JFrame. Reason: when the app started up, I wanted to get some data from it (and have it appear in the task bar for normal application selection), and also wanted the app to call the same window when running but as a dialog (ie: no extra task bar icon). However only the JDialog stopped the calling thread for the dialog.
    To get the JFrame to do the same, I invoked a thread and piled all of the logic into that, and when the user did all that I wanted them to, closed the Frame and released the thread with all of the statefull stuff that I wanted.
    Worked a treat.

  • Best way to make program wait for input from NI USB 9162?

    Hi, I'm somewhat new to Labview, but through all the tutorials and online help I'm still having trouble getting this to function properly.
    The USB adapter is hooked up to a network cable split into single wires reading in a voltage coming through several seperate oscillators.  
    Testing in the lab, the program included below works fine when I run the program, then quickly administer a shock to the table.  In the real world scenario though, I'm trying to make the program wait to record data until the first shock reaches the first oscillator before recording data, but I just can't seem to find an easy way to make this work.
    Attatched is an example of the program.  Any help would be greatly appreciated.  Thank you. 
    Attachments:
    Acq&Graph Voltage-Int Clk-rh-tt-1.vi ‏56 KB

      Hi,
    I think I have the answer you're looking for! Please see the attached VI.
    I moved the graph indicator inside the "true" case of the case structure. Before, your VI was sending data  to the graph from an empty timestamp constant with each iteration of the "false" case. Now the VI only sends data to the graph if a true is read.
    If you're wondering why it takes a bit of time for your graph to stop updating before it stops writing new data, it's because you're filling up a buffer of sampled data by using a queue. If you're writing to the buffer faster than you're reading from the buffer, you may encounter an "overflow" situation when the queue gets full. To avoid this, you might consider using a notifier rather than a queue. It's the exact same thing as a queue, but it gives you only the most recent value, allowing new values to overwrite old values.
    Hope this helps.
    Regards,
    Dan Richards
    Certified LabVIEW Developer
    Attachments:
    producer consumer DAQmx threshold.vi ‏57 KB

  • Wait for progressbar to finish then continue code?

    How would you create a program where you have to type a number in numericupdown which will change the progressbar's value number and
    then click button1. When click button1 you will be navigated to google.com and then progressbar will start. when progressbar is finished navigate to bing.com. Does anyone know how to do this?
    Thanks in Advance!

    I haved moved question to C# which can be found here: New
    Forum Question
    Hello,
    I have helped you move this thread to winform forum before you post the reply above.
    In addition, I found that you have got this issue resolved in that thread.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Wait for song to finish applescript

    I would like to have an applescript that will use the if statment to test if the selected song it finished and to pause the script until it does

    Well, without seeing more code, it is hard to tell for sure. What you may want to do, is to wrap your refresh in a synchronized block and wait, and then have your Form, a separate Thread I presume, notify when it is finished.
    public void add() {
      new TeamAdd(this); // pass this so you can notify later
      synchronized (this) {
        this.wait(); // wait until notified
        refresh();
    } Of course, you will have to put the corresponding notify() on the passed Object when you are through with it in TeamAdd, otherwise your main thread will hang forever.
    Hope this helps

Maybe you are looking for