开发者

Java: exchanging data between opened jPanel and jFrame

开发者 https://www.devze.com 2023-03-07 11:21 出处:网络
From the already opened jPanel I open the jFrame \"FastSearch\" search window using the following method:

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

精彩评论

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

关注公众号