I have a Code design question. Let me explain the scenario and then the question. I have 2 Panels below

Basically, the first panel on clicking start, opens the second panel. On the Second panel when the file is chosen (background blue). That file needs to be opened in the editor pane of the first panel.
The question is: What is the good practice to do it. Both my panels are separate classes. Currently the second panel keeps a reference to the first panel. And on selection, calls the respective method of the first class to output the csv. This is a bad design anyday.
How should the children frames refresh an aspect of the parent frame?
use
JDialog(parent, modal)instead ofJFrame, could be depends of modalitycreate
JDialogonly one time, reuse this container for another event came from parentJDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE), then every next actions are only aboutsetVisible(true/false)wrapped ininvokeLater()then return (check if contents changed, changes back to the parent
you can to put there verifications by users action from
JOptionPane("DYW to save changes ??"))