开发者

Java: exchanging data between opened jPanel and jFrame

From the already opened jPanel I open the jFrame "FastSearch" search window using the following method:

new FastSearch().setVisible(true);

which lists the search results. When I select one of the search results I want to send the value back to the parent jPanel which opened the child jFrame "FastSearch".

开发者_StackOverflowI thought it would look something like this:

ParentWindow.targetVariable = theValueFromTheOpenedForm;

But of course, it doesn't work.

How do I pass data between opened jPanel and jFrame?

Thanks in advance


You'll need to pass the object through to the FastSearch class in some way. Either in the constructor or through some other method. I'm assuming there is probably a listener interface.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜