Search code examples
javajemmy

How to use Container in find operation in Jemmy library?


Can anyone give explanation and an example of Container usage?

E.g. I am trying to find JProgressBar, and all the find method has Container as the first param.:

JProgressBar pb = JProgressBarOperator.findJProgressBar([Container cont]);

I supposed that JFrame or JDialog etc. could be used (cast) as Container, but it is not. So what is it?


Solution

  • The solution is to get Container of parent element by .getContentPane():

    JFrameOperator mf = new JFrameOperator("Main Frame");
    JDialogOperator jd = new JDialogOperator(mf, ""); // dialog that contains JProgressBar has no name
    JProgressBar pb = JProgressBarOperator.findJProgressBar(jd.getContentPane());