Getting data from JFrame AFTER the form is filled
        Posted  
        
            by mary jane
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mary jane
        
        
        
        Published on 2010-06-03T09:33:03Z
        Indexed on 
            2010/06/03
            9:34 UTC
        
        
        Read the original article
        Hit count: 241
        
I'm trying to get data for my application from a form set in an external window (getDataWindow extends javax.swing.JFrame). The problem is that functions are executed before form is filled in.
    getDataWindow dataW=new getDataWindow();
    dataW.setVisible(true);
    size=dataW.returnSize();
I've tried also adding additional boolean variable to getDataWindow
    getDataWindow dataW=new getDataWindow();
    dataW.setVisible(true);
    while(!dataW.checkIfReady()){wait();}
    size=dataW.returnSize();
But it makes also the window wait (it appears but it's black inside and nothing happens). I think i should create some threads for that - I've tried to call a window making function getDataWindow in java.awt.EventQueue.invokeLater(new Runnable()) but I had to initialize dataW earlier so dataW.checkIfReady() could be called, so it is a catch 22.
© Stack Overflow or respective owner