Jemmy库中查找操作如何使用Container?

How to use Container in find operation in Jemmy library?

任何人都可以给出 Container 用法的解释和示例吗?

例如我正在尝试查找 JProgressBar,并且所有查找方法都将 Container 作为第一个参数。:

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

我认为 JFrameJDialog 等可以用作(投射)容器,但事实并非如此。那是什么?

解决方案是通过.getContentPane()获取父元素的Container:

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