开发者

Getting data from JFrame AFTER the form is filled

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=开发者_JAVA技巧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.


Have you tried adding a listener in form contained fields ? I know you don't have full control over that class, but, well, it's some java code ! Run it in your debugger, and you'll see the code organization for that DataWindow. Then, you'll be able to add a Key/Action/Anything/Listener to trigger your code execution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜