Getting data from JFrame AFTER the form is filled
- by mary jane
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.