In my program, I had a JPanel(or inside JFrame) object when running the program, which has a JButton inside it, when I click on the Jbutton, it pop up (create) another JPanel object (not the same class as the original one) which will display the information passed from the original JPanel (e.g. a text string) in this new JPanel. Now When I click on the JButton on this new JPanel, another text string needs to be passed to the original JPanel and displayed on it. Then the newly pop-up JPanel will disappear.
My question is how to easily keep the communication between these two JPanels (two-way communication as described above)? Could you please provide a piece of codes just show how to do it?
Thanks a lot!