Wait for user to press ok in JFrame

I have two windows the main one is for setting configuration values.
the second is for one of the config values that is a list and i have made a JFrame that has the list and can remove and add things to it.
it also has a OK button for when the user has finished and a function to convert the list into a string i can store in my config file.
what i dont know how to do is make the main window wait until OK is press on the second window
then it needs to get the string with the list in it.
if you have some code or a tutorial you could point me towards that would be great.
Scott.

1) don't use a second JFrame, use a modal JDialog as this is precisely what it is built to do.
2) Have the class that produces the JDialog's components also have a public getter method(s) to extract what you want from the dialog once it has been closed.
3) Search the forum for examples. you'll find lots, many helpful.

Similar Messages

  • How to pause while document printing and wait for user actions.

    How to pause while document printing and wait for user actions. (for sample: pressed button). Pause after each printed pages.

    Print page by page after considering the user actions!

  • Wait For A Button Press

    Hey, I am currently creating a game and need to know how to wait for a certain button to be pressed. A popup message comes up that tells the user to press a button, then I need to wait for the button to be pressed. Then once the button is pressed, I want another message to come up. The problem is, I have no idea how to wait for a button press after the first message comes up. Instead it just displays the first message, then the second directly after.
    Thanks

    So you have a button that is always present. Normally clicking the button does nothing. But sometimes a message shows up, in which case if the user clicks the button, something happens. Right?
    UI principles aside (it's bad form to display a button that does nothing), this is pretty simple.
    Create a field to track whether the button does anything. For example:
    private boolean buttonActive = false;In your action listener for that button, first check the value:
    public void actionPerformed(ActionEvent e) {
        if (buttonActive) {
            // do your thing
    }If the buttonActive is true, it does something, otherwise it does nothing.
    After you display the message, set buttonActive to true. When you want the button to become a brick again, set it to false.

  • How to make Flash to wait for user input

    Hi,
    I found this PHP script, then I made some changes to make it
    FEED the Flash user interface with online user input.
    The main concept of this script is WAITING for user input, so
    it shows the messages and then go to next line and so on.
    The user input go to directly to TEXT file which writes in
    lines, each line has a unique id = (mag_id).
    There "get_msge.php" which works as the middleware between
    FLASH and messages text file.
    The problem, its doesn’t show any data while there are
    data in the text file.
    Help here please, best regards.
    This is the link of
    problem illustartion
    AS is:
    // create an object to store the variables
    varReceiver = new LoadVars();
    // load the variables from the text file
    varReceiver.load("get_msg.php?file_id=1&msg_id=1",
    "POST");
    // trigger something - when the variables finish loading
    varReceiver.onLoad = function(){
    //the variables have finished loading
    if (this.msg_id == 1) {
    _root.xmsg1_swf.text = this.msg;
    _root.xmsg1_ch.text = this.msg;
    gotoAndPlay("line2");
    } else {WAIT }
    PHP is:
    <?php
    //get these values from the FLASH
    $file_id_swf = $_POST ['file_id'];
    $file_name = "messages/messages".$file_id_swf.".txt";
    $msg_id_swf = $_POST ['msg_id'];
    // [0] ."||".[1] ."||".[2] ."||". [3] ."||".[4]."||". [5].
    //$msg_id."||".date."||".time."||".$from."||".$to."||".$msg.
    $fp = fopen ($file_name, 'rb');
    while (!feof ($fp))
    $msg_txt = fgets ($fp, 1024);
    $line = explode ("||", $msg_txt);
    $msg_id = $line[0];
    $from = $line[3];
    $to = $line[4];
    $msg = utf8_encode ($line[5]);
    if ($msg_id == $msg_id_swf)
    echo
    "msg_id=".$msg_id."&from=".$from."&to=".$to."&msg=".$msg;
    }//while
    fclose ($fp);
    ?>

    Well, given the things that you've written, I don't think it
    could. There technically isn't any code in flash that lets it
    "wait." In order to "wait," you must run the script over again
    until some condition is met.
    However, your code does look accurate. Why do you need to
    wait? The onLoad function will be invoked WHEN something is loaded.
    So, I don't see the reason for the "waiting."
    In addition to that, I would like to say that using text
    files isn't that great with flash. I have done this before and
    noticed several problems with using text files. The biggest problem
    is that the text files are cached after being loaded. Every time
    you re-load it again, you will get what you got the first time
    until you reset your cache (ie. close your browser). I suggest
    using MySQL. (Just my thought.)

  • Significant time waiting for User I/O on the hot object

    How to correct this warnings shone in enterprise manager's top most poor sql's in performance analysis ;
    The SQL statement with SQL_ID "dnpdchg674nrr" spent significant time waiting for User I/O on the hot object.
    Texto SQLSELECT COUNT(*) AS QTDCTA FROM CONTAS WHERE SITUACAOCT = 0 AND TIPOCT = 0 AND MA...
    Fowards Thanks
    Marcos Ortega
    Brasil

    Thanks, for so fast answers;
    Just one doubt; Significant user I/O; I thought to be related to many rows beeing request, or some like that;
    here is the plan ( contas is a huge table , more than 40 millions rows )
    SELECT COUNT(*) AS QTDCTA
    FROM CONTAS
    WHERE SITUACAOCT = 0 AND TIPOCT = 0 AND MATRICULA = :pMATRICULA
    SELECT STATEMENT, GOAL = ALL_ROWS                    5     1     26     
    SORT AGGREGATE                         1     26     AGGREGATE
    TABLE ACCESS BY INDEX ROWID     EOS     CONTAS          5     1     26     BY INDEX ROWID
    INDEX RANGE SCAN     EOS     I_LOCALIZ     2     4     3          RANGE SCAN

  • Display a message without waiting for user response

    Hi,
    I'm currently trying to find the best way to display a message, and multiple messages to the user, so that he is informed of the processing.
    I've tryied the dialog box but it's waiting for user confirmation so it interrupts the execution of the VI.
    Another precision is that I call the dialog in a case structure, so does it act?
    I'm thinking about using a VI dedicated to the displaying of the message but I may not be able to display multiple message boxes.
    Can anyone help me to use the best way?
    Thank you in advance.
    Bim

    You can build the message display into your vi by using the techniques shown in the attached vi (LV7.1.1)
    It is just a string indicator with large font size, and using property nodes to show/hide when necessary.
    - tbob
    Inventor of the WORM Global
    Attachments:
    MessageDisplay.vi ‏31 KB

  • Waiting for user logon...

    Hi,
    we're currently experiencing issues with random applications refusing to install with the message 'Waiting for user logon'. I'm seeing this in Software Center so obviously someone is logged on. It doesn't seem to matter if I'm logged in via RDP or directly
    on the pc. I've gone through the basics with the deployment monitoring tool and skimmed through some logs but nothing jumps out.
    I have to admit, I don't know a lot about sccm 2012 as it's no longer my area so my experience and training is mostly limited to sms / sccm 2007. I do know that the current guys running know very little and anything that doesn't work is a "known microsoft
    issue" - only they can never point you to a KB. I now work mostly in remediation of legacy apps to win 7 / x64 but being as it's not installing it's considered broken so naturally it has become my problem.
    Any help with this would be greatly appreciated!

    I attempted a CCMRepair on this client, and it didn't make a difference. I haven't yet uninstalled and reinstalled the client completely yet. 
    The CcmExec log shows (every time user logs in), that there's a login detected, and it shows it on session 2:
    Registering for Logon/Logoff notifications.
    Found user S-1-5-21-4083790691-3944967354-608316658-65900 on session 2
    Added CCM (user, session) is: (S-1-5-21-4083790691-3944967354-608316658-65900,2).
    No cached user during RegisterForLogon.
    New CCM (user, session) is: (S-1-5-21-4083790691-3944967354-608316658-65900,2).
    User 'S-1-5-21-4083790691-3944967354-608316658-65900' is logged on to session 2 during RegisterForLogon.
    Watching the other sccm logs as it attempts to install this application that's currently Waiting for User Logon, it essentially does this several times a second for a while. This is 10 minutes after the login log noted above. It is showing the correct
    user SID, but no session (-1). The logs were merged chronologically, and the log is noted at the end of each line where it came from.
    State message(State ID : 2002) with TopicType 1702 and TopicId MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25/5 has been recorded for S-1-5-21-4083790691-3944967354-608316658-65900
    StateMessage
    The target instance path is CCM_Application.Id="MyVendorId/Application_4a14ecbe-f411-41a6-b096-d0625d462d25",Revision="5",IsMachineTarget=0
    CCMSDKProviderRaising client SDK event for class CCM_Application, instance CCM_Application.Id="MyVendorId/Application_4a14ecbe-f411-41a6-b096-d0625d462d25",Revision="5",IsMachineTarget=0,
    actionType 23l, value , user S-1-5-21-4083790691-3944967354-608316658-65900, session 4294967295l, level 0l, verbosity 30l
    CIAgentState message with TopicType 1702 and TopicId MyVendorId/Application_4a14ecbe-f411-41a6-b096-d0625d462d25/5 has been updated
    StateMessage
    The action type is 23
    CCMSDKProvider
    The user SID is S-1-5-21-4083790691-3944967354-608316658-65900
    CCMSDKProviderThe logon session ID is -1
    CCMSDKProvider
    The message level is 0
    CCMSDKProvider
    The verbosity is 30
    CCMSDKProvider
    The value is
    CCMSDKProviderJob({E9FD9460-DC59-434D-9661-45C96253174E}): Setting
    priority to 5 : Task(MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25.5.Enforce)
    CIAgent
    CCIStateStore::SendStateMessages - ModelName: MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25, Version:5 UserID:S-1-5-21-4083790691-3944967354-608316658-65900, Priority: 5
    CIStateStore
    CIStateStore
    An existing CI state is changed
    CIStateStore
    [MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25:5] CIEnforceState changed: Enforcing --> WaitingForUserLogon
    CIStateStore
    [MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25:5] AreDetailsUpdated: No
    CIStateStore
    CIStateStore
    GetAllInstances - 1302 instance(s) of 'CCM_StateMsg' found
    StateMessageProvider
    State message with TopicType 1701 and TopicId MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25/5 has been updated
    StateMessageGetAllInstances - 1302 instance(s) of 'CCM_StateMsg' found
    StateMessageProvider
    Job({2C94A554-48CE-4CB6-9B70-6AC79B8A6B58}): Already Completed : Task(MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25.5.Enforce)
    CIAgentCCIStateStore::SendStateMessages - ModelName: MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25,
    Version:5 UserID:S-1-5-21-4083790691-3944967354-608316658-65900, Priority: 5
    CIStateStore
    CIStateStore
    An existing CI state is changed
    CIStateStore[MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25:5]
    CIEnforceState changed: WaitingForUserLogon --> Enforcing
    CIStateStore[MyVendorId/RequiredApplication_4a14ecbe-f411-41a6-b096-d0625d462d25:5]
    AreDetailsUpdated: No
    CIStateStore

  • How to satisfy "Waiting for user logon" requirement for multiple machines

    Let me preface this by saying I know the "real" solution is to make my package run whether or not a user is logged on, but here me out.
    I have some packages that someone else builds where they're set to only run when a user is logged on, which then in Monitoring builds up quite a few "waiting for user logons" since some machines go unused for a week at a time.
    Is there any slick way to get around that?  or to have a script which logs on to a list of machines then logs off after say 10 minutes so the SCCM installs can occur?

    if you are worried about packages deploying to user machines irrespective of logged in or not,why dont go with program settings 'whether or not used logged in' instead of choosing 'only when user logged in' and try for other alternatives to install app
    .'whether or not used logged in' will straight away install the applications for you .
    Eswar Koneti | Configmgr blog:
    www.eskonr.com | Linkedin: Eswar Koneti
    | Twitter: Eskonr

  • How do you keep a VI running while waiting for user input?

    I have a VI that:
    1.  The user enters set points.
    2.  The user starts the VI and the VI sends the set points to an external process via a serial interface.
    3.  The VI  stops running.
    4   The user waits for the external process to complete.
    5.  Repeat sequence. Go to Step 1.
    This works well except for one small problem.  Starting the VI in step 2 causes an external micro controller to reset.  During the reset it will ignore set point commands.  To get around this problem a delay has been added between when the VI opens the serial port and when the VI sends the set points to the external process   Is it possible to keep a VI running continuously in this type of application, thereby eliminating the start up and shut down of the serial interface?
    If yes, how do you keep a VI running while waiting for user input?
    Howard

    The ones for the event structure specifically. I'm posting from my phone. Look at the basic ones for user input. even a simple while loop with a boolean and a case statement would work.

  • Iphone connection to a Vista ad hoc connection: "waiting for users"

    I am trying to create an 'Ad hoc' connection between my iPhone and a Windows Vista laptop. After I have set up the ad hoc network on the laptop I am able to see the network in the iPhone's list of WiFi connections and clicking on this shows that it connects (the little tick appears next to the connection name and it appears to receive an IP address). However, when I return to Vista it says that it is "Waiting for users to connect".
    I have tried various solutions to this problem, including resetting the network settings on the iPhone, recreating the ad hoc network in Vista (with and without security), and manually changing some of the adapter settings with Vista... all to no avail!
    Does anyone have any suggestions on how I might force the connection to be made?

    My laptop Sony vaio VGN-SR11MR does not connect to iPhone 3g
    Wifi adapter: atheros ar928x.
    Operating system: Windows Vista SP1
    Actions on the laptop:I have created ad-hoc a network -> "Waiting for users to connect to your adhoc network"
    Actions on the phone:Phone finds the network. It tries to connect -> Ok
    But, on the laptop varies nothing...
    The laptop incorporates to other laptop on ad-hoc. Phone too incorporates to other laptop on ad-hoc.
    Driver ar928x - 7.6.0.154
    Firmware iPhone 3g - 2.1
    The problem decision has been found?
    Message was edited by: Horzer

  • 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.

  • Wait for user input in for loop

    I'm pretty new to labview and I'm having a hard time figuring out how to do this. Basically, I need the user to press a GO button and data aquisition will take place saving it in an array, then the program will wait for the user to press the GO button again and the data aqusition will add more values to the array, and the whole process will repeat 5 times and finally it will average the values.
    To try and figure out how to do this, I tried making a program that loops 5 times and adds a random number to an array with each loop (using shift registers) but I CANNOT figure out how to make each loop iteration wait on the user to press a button. Any advice?

    Hi Roger,
    you can use a dialog in your for loop, or better you use an event structure to react on user inputs. If you use the event structure you can count the button press events and store them in a shift register. With a compare function you can check if your limit is reached and react on it.
    Mike

  • How to do custom dialog so it displays the dialog and waits for user to end

    I have an application that I want to create my own dialog screens. For example, the user cliks on one frame, and I want to open a window for the user to enter data, after the user finishes, he presses OK and then the main app continues.
    On the class that I open the dialog, I open it with:
    NewOkCancelDialog.abrePopup();
    System.out.println("Program should wait for the dialog to close");And the 'NewOkCancelDialog' class is defined like:
    public class NewOkCancelDialog extends javax.swing.JDialog {
    The constructor is like:
    public NewOkCancelDialog(java.awt.Frame parent, boolean modal) {
    super(parent, true);
    initComponents();
    this.setLocation(400,400);
    This methods are when the user activates the button and the popup closes..
    private void cierraPopupOk(){
    resultados.setciudad1(this.fld_ciudad1.getText());
    if (resultados.getciudad1length() < 3) {
    System.out.println("Error en la entrada!");
    } else {
    doClose(RET_OK);
    private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {                                        
    cierraPopupOk();
    private void doClose(int retStatus) {
    returnStatus = retStatus;
    this.estaAbierto = false;
    setVisible(false);
    dispose();
    I would like to have the application in the first lines, after calling
    NewOkCancelDialog.abrePopup();
    to wait until the method doClose() in NewOkCancelDialog class is finnished. But right now, after the ...abrePopup() is called, it continues.
    What am I doing wrong? or what am I not doing?

    Use the "code" tags not the "bold" tags when posting code.
    But right now, after the ...abrePopup() is called, it continues.Well your posted code doesn't show this method so we don't know what you are doing in this method.
    Why are you using a static method to show the dialog? Normally the code would be:
    JDialog dialog = new CustomDialog();
    dialog.setVisible( true );
    But you are correct with the basic idea in that you need to use a modal dialog.

  • Wait for user to select the OK button

    For my application I cannot use a simple MessagePopup where the user must select the OK button to continue.
    I created a new panel with just a text message and an OK button to act like a MessagePopup.
    When I call InstallPopup and the Panel box pops up I want to wait until the user selects OK before continuing just like the MessagePopup.
    How can I accomplish this?
    Thanks!
    John W.
    Solved!
    Go to Solution.

    You can use GetUserEvent () function. In the scenario you have depicted you must have all controls in the popup panel set as "Normal" and only the OK button set as "Hot" (The default control mode). The callback the must handle the panel can be structured like this:
    int pnl, ctl, handle;
    // some code here
    // Code to handle the popup
    handle = LoadPanel (.....)
    InstallPopup (handle);
    GetUserEvent (1, &pnl, &ctl); // Wait for the user to press OK button
    DiscardPanel (handle);
    // The rest of the code here
    This help topic gives you additional informations on this subject.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Error while creating user on Unix through OIM timeout waiting for user password

    Hello all ,
    we made integration with Unix using connector  , while creating user  we receive the following error
    <Jun 27, 2013 1:30:14 PM AST> <Error> <ORACLE.IAM.CONNECTORS.ICFCOMMON.PROV.ICPROVISIONINGMANAGER> <BEA-000000> <oracle.iam.connectors.icfcommon.prov.ICProvisioningManager : createObject : Error while creating user
    org.identityconnectors.framework.common.exceptions.ConnectorException: Exception occured while setting the password.org.identityconnectors.framework.common.exceptions.OperationTimeoutException: Command timed-out while waiting for: new[\s](unix[\s])?password:
            at org.identityconnectors.genericunix.GenericUnixConnection.setUserPassword(GenericUnixConnection.java:866)
            at org.identityconnectors.genericunix.operation.GenericUnixCreate.setUserPassword(GenericUnixCreate.java:193)
            at org.identityconnectors.genericunix.operation.GenericUnixCreate.analyzeResult(GenericUnixCreate.java:233)
            at org.identityconnectors.genericunix.operation.GenericUnixCreate.createOp(GenericUnixCreate.java:180)
            at org.identityconnectors.genericunix.operation.GenericUnixCreate.create(GenericUnixCreate.java:111)
            at org.identityconnectors.genericunix.GenericUnixConnector.create(GenericUnixConnector.java:200)
            at org.identityconnectors.framework.impl.api.local.operations.CreateImpl.create(CreateImpl.java:80)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunnerProxy.invoke(ConnectorAPIOperationRunnerProxy.java:93)
            at $Proxy363.create(Unknown Source)
    any one can support me how to fix this

    Try increasing the commandTimeout from 100seconds to 200seconds and see if this works?
    Also, look at the Section 5.2.5 in the connector doc.

Maybe you are looking for

  • Remove attachments in Mail fails

    Since I first installed Yosemite, I am no longer able to remove attachments in Mail. I use a POP account to download my email from a Microsoft Exchange Server and store the mail with attachment(s) on my iMac. The email plus attachments(s) are now phy

  • BO & Xcelsius

    Hello Gurus, Our company is planning to develop Dashboard using BO & Xcelsius. We have ECC5.0 & BW3.5. We have a complete range of BW reports for SD / FIN / CO / MM functions. In addition to getting outside help, company wants us to get trained. Coul

  • How to start compiz from entrance

    is entrance (X login manager) only for enlightenment? i can't find any options/settings to add compiz to the list of desktops i can login from entrance. any ideas? thanks, shane

  • How to hide pm shop paper keys in order which is not required.

    Dear All, I have created one b/d maintenance order which is released, now I have to take a print out of shop papers. For this I have ref. following menu path through IW32 transaction Order>Print>Order Then one window will get pop up u201Cselect shop

  • Create Instruction Manual with same style, different languages?

    How to create a book with graphs and tables (instruction manual) in one language and create afterwards many different linked copies where just the language should be manually changed? While editing the original (graphs etc..) the copies now should ch