If statement on a while loop condition

Hello,
I was just wondering whether it was possible to have an if statement on a while loop. Basically, I have a while loop that has the following terminating condition
do{
//...loop code here
while (netError > acceptableError && learningCycle < 100000 && alive);I'm looking to introduce a boolean "ignoreMaxCycles" that basically stops the loop from taking notice of the learningCycle clause of the condition.
do{
//...loop code here
while (netError > acceptableError && alive);I know it can be done repeating the two loops with an if statement governing which one is executed, but I was wondering whether there was a shorter/cleaner way of doing this?
Thanks,
Nick

nickd_101 wrote:
Hello,
I was just wondering whether it was possible to have an if statement on a while loop. Basically, I have a while loop that has the following terminating condition
do{
//...loop code here
while (netError > acceptableError && learningCycle < 100000 && alive);I'm looking to introduce a boolean "ignoreMaxCycles" that basically stops the loop from taking notice of the learningCycle clause of the condition.
do{
//...loop code here
while (netError > acceptableError && alive);I know it can be done repeating the two loops with an if statement governing which one is executed, but I was wondering whether there was a shorter/cleaner way of doing this?
Thanks,
Nick
do {
while(netError > acceptableError && (ignoreMaxCycles || learningCycle < 100000) && alive)wtf ? i took 2 minutes for that ?
Edited by: darth_code_r on Aug 29, 2008 9:21 AM

Similar Messages

  • Help with a while loop condition

    I'm trying to write to a File. I ask the user for input, then I enter a while loop and test the condition. The loop works, but it won't stop. I've tried everything. Here is my code please help!!
    thanks
    inputline = keyboard.readLine();//read the keyboard
    try{
    while( inputline != null ){
    DiskOut.println( inputline );
    DiskOut.flush();
    inputline = keyboard.readLine();//read the keyboard again
    }//end while
    }//end try
    catch (IOException e) { 
    e.printStackTrace();
    }//end catch
    also i've tried these while loop conditions:
    while(inputline != "\n" || inputline != "\r") and the sort

    while(inputline != "\n" || inputline != "\r")The condition
    X!=Y OR X!=Z (given Y != Z)
    is always true. X will always not be equal to at least one of the values. So you'll want to use:
    while(!inputline.equals("\n") && !inputline.equals("\r"))In other words, "while inputline is not equal to either of them". Note the use of && instead of ||.
    If "keyboard" is simply a BufferedReader on top of System.in (and not your own class), the trailing line feeds and carriage returns won't even be in the string returned by readLine(). Your best bet is this:
    while(null != inputline && 0 != inputline.length())Make sure you type the two parts of that AND condition in the order above. If for whatever reason there are trailing \r and \n on the strings, you'll want to accomodate for platforms that may include both characters.
    // trim the trailing newline characters
    while(inputline.endsWith("\r") ||
          inputline.endsWith("\n")) {
       inputline = inputline.substring(0,inputline.length()-1);
    // or maybe this will work if you don't mind losing
    //  the whitespace at the beginning of the string:
    inputline = inputline.trim();Hope that helps somewhat.

  • While loop condition check

    Dear All,
    attached is an NI that does the following.
    1. The user inputs a frequency and amplitude range to drive a speaker.
    2. A laser displacement sensor measure the speaker displacement, checks if it is in the desired range, and jumps on to the next frequency, if its not in the desired range it tries another drive voltage.
    The program works fine, the problem is, is that the while loop checks the condition in the beginning or the middle of the loop, therefore if it is in range instead of stoping at that particular amplitude and frequency, it goes to the next amplitdue before going to the next frequency. Since at the begining of the loop execution the condition was different that in the middle.
    How can I force the while loop to read the condition only after the sequence inside has completed.
    Thank you
    Ala
    Attachments:
    AmpFinder.vi ‏431 KB

    Dear All,
    I think this fixes the problem
    Cheers,
    Ala
    Attachments:
    AmpFinder.vi ‏431 KB

  • Editing While Loop Conditions hangs JDeveloper 10.1.3

    Hi Guys,
    Having a strange problem when I tried to edit the condition in a while loop after it was created and set first time. The IDE just hanged when I tried to open the expression builder and after a while, nothing happened, the expression builder didn't show up.
    I went and deleted the condition by editing the source, basically made condition from:
    <while name="While_1"
    condition="bpws:getVariableData('inputVariable','payload','/client:WhileLoopTesterProcessRequest/client:input')&lt;10">
    to
    <while name="While_1"
    condition="">
    Switched back to graphics mode, the expression builder opens up normally.
    I understand that we are evaluation a Developers Preview, so just wanted to bring this to the notice of the developers.
    Any solutions before the Production release?
    Regards,
    - Soumen.

    Hi Willian,
    Did you set up your "Model" Project to use the JDK 1.4 and rebuild the application ?
    See " [Deploying to Application Servers That Support JDK 1.4|http://tinyurl.com/lfc6kc] "
    Regards,
    Didier.

  • How to use return value from TestComplete ( using COM) as a variable in the conditional statement (e.g. while loop) in TestStand

    Hi,
    I have setup a COM interface for TestStand(TS) to run certain scripts in TestComplete (TC).  Normally, when TestComplete finishes executing the script, it returns a 0 or 1 to denote pass/fail in the TestStand step (e.g String value test step).  This worked fine.
    However, now I need TestComplete to return a vaule( e.g 32) to TS, and TS need to evalue this value in a while statement. So if TC return value is 32, I'd have some statement in TS ike :                                                                                                 
    While (return value != 30)
    Do something..
    Thanks,
    Solved!
    Go to Solution.

    There are a hundred ways to implement what you are asking.  The hard part is deciding which one would be the best for you.
    What adapter are you using to communicate with TestComplete?  ActiveX?  Is TestComplete running asynchronously (in parallel)?  If so then how is the data getting back to TestStand?
    So here are some options:
    1. You can use the While Step type.  It's in the Flow Control folder in your Step Types pallette.  Look in your examples under UsingFlowControlSteps.seq in the SequenceFlow
    2. You can loop on a step and have the termination for the loop be (return value == 30).  Look in the Step Properties under Looping.  Also in the TestStand help
    3. You could do Post Actions based on a condition and have it jump to another step.  Read about it in the TestStand Reference Manual.
    4. You could use a GoTo step.  I don't really recommend this one.  It makes code hard to maintain.  Also an example in SequenceFlow called gotobeep.seq.
    Hopefully this gets you thinking.  Let me know if you have specific questions about any of these methods.
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • While loop hangs in my script

    Hi guys,
    I want to check if SCCM (install windows image) is ready.
    If it's not, than it has to sleep. I want this in a while loop because when it takes longer, it must loop another
    5 minutes.
    When the image is ready it must go back to the rest of this script.
    My loop hangs and the script never finishes. What am i doing wrong?
    Kind regards,
    André
    $compObject = get-wmiobject -query "select * from SMS_R_SYSTEM WHERE Name='$hostName'" -computername "dhgms401" -namespace "ROOT\SMS\site_S01"
    $compObjectstatus = $compObject.client
    do {
    Start-Sleep -Seconds 300
    while ($compObjectstatus -eq 0)
    write "Sccm is klaar "
    Write "$hostName has been started"
    $newHostName = Get-ADComputer -filter {(name -eq $hostName)}

    Not 100% sure but, I believe the issue is with your conditional statement for your while loop
    while ($compObjectstatus -eq 0)
    $compObjectStatus will never change so your while loop will never equal 0 unless it did from the begining. You will have to requery each time to get an update on the status, so possibly create a function on the query end of things, and just run the function
    Function GetStatus
    $compObject = get-wmiobject -query "select * from SMS_R_SYSTEM WHERE Name='$hostName'" -computername "dhgms401" -namespace "ROOT\SMS\site_S01"
    $compObjectstatus = $compObject.client return $compObjectstatus
    do {
    Start-Sleep -Seconds 300
    while (GetStatus -eq 0)
    write "Sccm is klaar "
    Write "$hostName has been started"
    $newHostName = Get-ADComputer -filter {(name -eq $hostName)}
    I cannot test so I do not know if it works as expected
    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
    Don't Retire Technet

  • How to code a parallel 'for loop' and 'while loop' where the while loop cannot terminate until the for loop has finished?? (queues also present)

    I've attached a sample VI that I just cannot figure out how to get working the way that I want.  I've labeled the some sections with black-on-yellow text boxes for clarity during the description that follows in the next few sentences.  Here's what I want:
    1) overall -- i'm intend for this to be a subVI that will do data acquisition and write the data to a file.  I want it to use a producer/consumer approach.  The producer construct is the 'parallel for loop' that runs an exact number of times depending on user input (which will come from the mainVI that is not included).  For now I've wired a 1-D array w/ 2 elements as a test case.  During the producer loop, the data is acquired and put into a queue to be delt with in the consumer loop (for now, i just add a random number to the queue).
    2) the consumer construct is the 'parallel while loop'.  It will dequeue elements and write them to a file.  I want this to keep running continuously and parallel until two conditions are met.
          i. the for loop has finished execution
          ii. the queue is empty.
       when the conditions are met, the while loop will exit, close the queue, and the subVI will finish. (and return stuff to mainVI that i can deal with on my own)
    Here's the problems.
    1)  in the "parallel for loop" I have a flat sequence structure.. I haven't had time to incorporate some data dependency into these two sequential sections, but basically, I just care that the "inner while loop" condition is met before the data is collected and queued.  I think I can do this on my own, but if you have suggestions, I'm interested.
    2)  I can easily get the outer for and while loops to run sequentially, but I want them to run in parallel.  My reasoning for this is that that I anticipate the two tasks taking very different amounts of time. .. basically, I want the while loop to just keep polling the queue to get everything out of it (or I suppose I could somehow use notifiers - suggestions welcome)...  the thing is, this loop will probably run faster than the for loop, so just checking to see that the queue is empty will not work... I need to meet the additional condition that nothing else will be placed in the queue - and this condition is met when the for loop is complete. basically, I just can't figure out how to do this.
    3) for now, I've placed a simple stop button in the 'parallel while loop', but I must be missing something fundamental here, because the stop button is totally unresponsive.  i.e. - when I press it, it stays depressed, and nothing happens.
    suggestions are totally welcome!
    thanks,
    -Z
    Attachments:
    daq01v1.vi ‏59 KB

    I'd actually like to add a little more, since I thought about it a bit and I'm still not quite certain I understand the sequence of events...
    altenbach wrote:
    zskillz wrote:
    So i read a bit more about the 'dequeue element' function, and as I understand it, since there is no timeout wired to the dequeue element function, it will wait forever, thus the race condition I suggested above can never happen!
    Yes, you got it!
    As I've thought about it a bit more, there's a few things that surprise me... first, the reason the 'dequeue element while loop' errors is not because there's nothing in the queue, it's becaues the queue has been released and it's trying to access that released queue...   However the problem I have is this --- Even though there's no timeout wired to the dequeue element, I still would think that the while loop that contains it would continue to run at whatever pace it wanted -- and as i said before.. most of the time, it would find that there is nothing to dequeue, but once in a while, something is there.  however, it seems that this loop only runs when something has been enqueued.  the reason I say this is illustrated in the next code sample MODv2 that's attached below.  I've added a stop button to the "queue size while loop" so the program runs until that is pressed.  I've also added a simple conditional in the "dequeue while loop"  that generates a random number if it a button is pressed... but this button is totally non-responsive... which means to me that the "dequeue while loop" isn't actually continuously running, but only when an element is added to the queue.  this still seems almost like the 'dequeue while loop" waits for a notifier from the queue telling it to run.  can you explain this to me? because it is different from what I expect to be happening.
    rasputin wrote:
    I tried to open your VIs but it doesn't work. LV
    is launched, the dialog box (new, open, configure...) opens and then...
    nothing. Not even an error message. I guess it isn't a problem of LV
    version or a dialog box would appear saying this. Could you, please,
    send a image of the code?
    Thanks,
    Hi Rasputin, I'm using LV8.  I assume that was your problem, but who knows.  I've attached a pic of of altenbach's solution since it's what I needed.
    thanks
    -Z
    Message Edited by zskillz on 10-20-2006 11:49 AM
    Attachments:
    daq01v1MODv2.vi ‏63 KB
    daq01v1MODpic.JPG ‏116 KB

  • I have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    Hi fais,
    Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
    You can replace the inner for loop with a while by doing the following.
    1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
    2) Make sure the tunnels you where indexing on with the for loop are still indexing.
    3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
    4) Wire the output of the array size into the new while loop.
    5) Set the condition terminal to "stop if true".
    6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
    7) C
    reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
    8) Drop a "less than" node inside the inner while loop.
    9) Wire your iteration count into the bottom input of the "less than".
    10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
    Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
    I will let others explain how to takle this task using the "case solution".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • While loop problems

    hey guys,
    i made a program that counts any system with single character values (binary, ternary, octal, decimal,...etc) I am asking the user to input a starting point to count from and a stoping point to stop at. It starts from the correct place but does not stop.
    For some reason it is ignoring my while loop condition. anyone got any idea why this would happen?
    import javax.swing.*;
    import java.util.*;
    class Counting
         public static void main(String[] args)
              String input,start,stop,s;     
              int spaces;
              input = JOptionPane.showInputDialog("Enter number of spaces.");
              spaces = Integer.parseInt(input);
              s = JOptionPane.showInputDialog("Enter counting symbols in sorted order.");
              start = JOptionPane.showInputDialog("Enter the stating number. (" + spaces + " characters).");
              stop = JOptionPane.showInputDialog("Enter the number to stop at. (" + spaces + " characters).");
              StringBuffer num = new StringBuffer(start);
              int lspace = spaces - 1;
              int i,j;
              String k,z;
              System.out.println(num);
              while(num.equals(stop)!=true)
                   k = Character.toString((num.charAt(lspace)));
                   z = Character.toString((s.charAt(s.length()-1)));
                   if(k.equals(z)==false)
                        i = s.indexOf(num.charAt(lspace));
                        num.setCharAt(lspace, s.charAt(i+1));
                   else
                        num.setCharAt(lspace, s.charAt(0));
                        lspace--;
                        i = s.indexOf(num.charAt(lspace));
                        num.setCharAt(lspace, s.charAt(i+1));
                        lspace = spaces - 1;
                   System.out.println(num);
              System.exit(0);
    }

    i got it to work.
    here is the if anyone is interested. Thank for the help!
    import javax.swing.*;
    import java.util.*;
    class Counting
         public static void main(String[] args)
              String input,start,stop,s;     
              int spaces;
              input = JOptionPane.showInputDialog("Enter number of spaces.");
              spaces = Integer.parseInt(input);
              s = JOptionPane.showInputDialog("Enter counting symbols in sorted order.");
              start = JOptionPane.showInputDialog("Enter the stating number. (" + spaces + " characters).");
              stop = JOptionPane.showInputDialog("Enter the number to stop at. (" + spaces + " characters).");
              StringBuffer num = new StringBuffer(start);
              int lspace = spaces - 1;
              int i,j;
              String k,z;
              System.out.println(num);
              while(!num.toString().equals(stop))
                   k = Character.toString((num.charAt(lspace)));
                   z = Character.toString((s.charAt(s.length()-1)));
                   if(k.equals(z)==false)
                        i = s.indexOf(num.charAt(lspace));
                        num.setCharAt(lspace, s.charAt(i+1));
                   else
                        while((Character.toString((num.charAt(lspace)))).equals(z)==true)
                             num.setCharAt(lspace, s.charAt(0));
                             lspace--;
                        i = s.indexOf(num.charAt(lspace));
                        num.setCharAt(lspace, s.charAt(i+1));
                        lspace = spaces - 1;
                   System.out.println(num);
              System.exit(0);
    }

  • Why does a sequence structure execute if a while loop is to the left of it?

      I have a while loop in a case structure whose boolean is wired to a sub vi.  To the right of this structure I have a sequence that executes regardless of the while loops condition.  I assumed that the program would not continue to the case structure until the while loop stopped.  Then it would proceed to the case structure.
    Thank You

    jemengineering wrote:
      I have a while loop in a case structure whose boolean is wired to a sub vi.  To the right of this structure I have a sequence that executes regardless of the while loops condition.  I assumed that the program would not continue to the case structure until the while loop stopped.  Then it would proceed to the case structure.
    As others have mentioned, you have to familiarize yourself with the core idea of dataflow programming. One of the great powers of LabVIEW is the fact that things can occur in paralell unless there is data dependency.
    A good start would be the LabVIEW beginners online tutorial:
    http://www.ni.com/swf/presentation/us/labview/aap/default.htm
    The quiz #1 on slide 11 deals with the above issues. Try to answer it. 
    In your particular case, you need to force execution order. This can be done by creating a data dependency (preferred) or by the use of a sequence structure. You could e.g. create a 2-frame flat sequence and place the loop in the first frame and the case structure in the second frame.
    The picture shows a few scenarios for comparison. Can you spot the differences?  Understanding dataflow is crucial for writing any LabVIEW program.
    Message Edited by altenbach on 07-31-2006 06:49 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ExecutionOrder.png ‏19 KB

  • Quit while loop in event structure

    Hello,
    I used event structure in my application and I would like to quit a while loop in an event structure when I pressed a control. But I have a problem because I'm in the event.
    Do you have a solution.
    Sam.
    Attachments:
    Problem.vi ‏34 KB

    Hi,
    connect a true constant to the While loop conditional terminal in the STOP event case.
    See your example modified.
    Good luck,
    Alberto
    Attachments:
    Problem[2].vi ‏35 KB

  • While loop in plsql

    Hi ,
    I execute the below code in TOAD.
    DECLARE
    CURSOR c1
    IS
    SELECT *
    FROM tab
    WHERE ROWNUM < 5;
    cd c1%ROWTYPE;
    BEGIN
    OPEN c1;
    FETCH c1
    INTO cd;
    WHILE c1%FOUND
    LOOP
    DBMS_OUTPUT.put_line ( 'tname '
    || cd.tname
    || ' tabtype '
    || cd.tabtype
    END LOOP;
    -- FETCH c1
    -- INTO cd;
    END;
    And got the below error..
    Error at line 2
    ORA-20000: ORU-10027: buffer overflow, limit of 20000 bytes
    ORA-06512: at "SYS.DBMS_OUTPUT", line 32
    ORA-06512: at "SYS.DBMS_OUTPUT", line 97
    ORA-06512: at "SYS.DBMS_OUTPUT", line 112
    ORA-06512: at line 19
    If I add another FETCH INTO statement in the while loop block ,I will get the output.
    But please let me know why I am getting this error exactly and how another FETCH INTO is preventing it.
    Thanks.

    930414 wrote:
    I execute the below code in TOAD.There is a more serious problem here - abusing server memory by abusing DBMS_OUTPUT.
    Your code violates the basic principle of client-server. It copies (potentially large chunks) of data from server memory (buffer cache) into other server memory (PL/SQL engine's PGA memory).
    Then the client (TOAD in this case), reads the data from the PGA. Which does NOT cause the PGA to shrink, and allocated memory to be given back to the o/s as free memory.
    If your code is executed by 10 clients, there will be 10 clients abusing server memory.
    The code is not performant. Is not scalable. And just bloody dangerous as it could lead to a server with insufficient memory, swapping virtual memory pages between disk cache and RAM so frantically, that even the kernel stuggles to get a single millisec of execution time.
    DBMS_OUTPUT does not "print" stuff. It is not intended to be used for "printing" data for the client. DBMS_OUTPUT is a primitive interface for keeping a text buffer on the server, for recording basic debug-like messages and data. After server code has been executed (and recorded their debug messages), the client can read and display this buffer. That is how DBMS_OUTPUT should be used - and not as some kind of print device to "print" server data for the client.

  • Problem writing condition of a while loop

    I'm receiving an error when attempting to compile my class.
    while(numItems != 1 || 2 || 3) (numItems is an integer variable)
    Basically, using the Scanner class, I request an integer input from the user, and that input needs to be either 1, 2 or 3, so I have included the while loop as a validation tool, so that whenever the user's input is NOT 1 or 2 or 3, the system prints out an error message and the user has to reenter. However, the code above is highlighted when I compile, and the error description states that I cannot use the || operator for the int data type. I wasn't sure if the OR operator was two || pipes or one, but I receive the same error regardless.
    Is there a way around this?
    Thank you.

    ryanz0r wrote:
    I'm receiving an error when attempting to compile my class.
    while(numItems != 1 || 2 || 3) (numItems is an integer variable)
    Basically, using the Scanner class, I request an integer input from the user, and that input needs to be either 1, 2 or 3, so I have included the while loop as a validation tool, so that whenever the user's input is NOT 1 or 2 or 3, the system prints out an error message and the user has to reenter. However, the code above is highlighted when I compile, and the error description states that I cannot use the || operator for the int data type. I wasn't sure if the OR operator was two || pipes or one, but I receive the same error regardless.
    Is there a way around this?Hi, Ryaz0r.
    In conjunction with Encephalopathic's syntax question for your valid boolean expression, you'll also have to replace the || operators with the && operators to achieve your described condition.
    -- L. James
    L. D. James

  • Allow state machine while loop to end only in 1 of the states?

    What is the best way to ensure that the while loop that surronds state machine case structure only ends in a certain one of the states?

    I have solved the problem of having the VI not stopping (apparently it was due to an event structure). However, now I have another slight problem. I need the state machine to terminate on either of two conditions:
    1) If a stop button is pressed
    OR
    2) if the end of the sequence is reached.
    As I have implemented it so far the VI terminates because of the second condition and does not allow me to terminate it by pressing a 'Stop' boolean button. I know that this might be a bit fundamental and simple but I'm new with state machines on labview.
    Thanks.
    Attachments:
    State machine.vi ‏21 KB

  • How to call sub VI and close the main VI in while loop and sequence condition

    Hiya,
    I have a problem with the while loop and the sequential condition in placed together i.e while loop as Global and sequential condition as local (i.e inside the Global loop). For example,when calling the sub vi from the main vi (main vi as main menu and sub vi as sub menu.)My problem is I can't run my sub menu when the particular icon is pressed through the main menu and only the front panel appears. My concerned was if possible the sub menu is activated in few second then jump back to the main menu again (analyze through the diagram).So, I don't know what should I need to do. If possible, please advice me how to encountered that particular problem.
    Thanks!

    Go to your block diagram of your main menu, then click on the "Hightlight Execution" it is something like a bulb. then you execute your vi. then LV will show you all your data flow.
    When you feel sad, laugh

Maybe you are looking for

  • Error when transporting a transformation (Update rule) BI 7.0

    Error when transporting a transformation (Update rule) BI 7.0 Hi all, I’m trying to transport the transformation between the infocube 0FIGL_C10 and the ODS 0FIGL_010 from BI Dev into BI QAS. I kept getting a return code 12. Transport message:    Prog

  • Email notifications not being sent

    Hello all - I have two Mac Mini Servers - both running 10.6.5 One server is within my LAN and behind an Apple Airport Extreme which is acting as a router. The other server is collocated and has a direct connection to the internet. It is running the s

  • Missing of Business partner and Individual objects linkage.

    Hi , We are implementing CRM 7.0 service.We don't have equipments(cannot able to see it in IE03 and equipment number will be in EQUI,Since equipment view is not activated in serial number profile of material) and have serial numbers generated for the

  • Feature Suggestion for iCal and Contacts

    Many times, I will have a calendar entry with a conference call dial-in number in the Notes section of the appointment. Unfortunately, the calendar does not allow me to dial that number by touching it like mail does. It would be nice if I could do th

  • Having problem with "windows on top" in jre 6 update 12

    I'm having issue with the jre 6 update 12 with our Swing application. It works fine with update 11. The issue is that my JFrame is somehow getting set to be "always on top" once I've opened an closed a modal dialog from that JFrame. Here is the steps