Hello, in this code suppose that the dlg is defined in one case as a JDialog, I run it and the JDialog is executed AFTER closing it, so the message is printed after closing the JDialog.
But when I run the code with dlg defined as JPanel it prints the message before I close the JPanel.


Code:
jmnuTest.addActionListener(
         new ActionListener()
         {
            public void actionPerformed(ActionEvent e)
            {
               jmnuTest_actionPerformed(e);
            }
         });
Code:
private void jmnuTest_actionPerformed(ActionEvent e)
   {
      Testwhen dlg = new Testwhen(this);
     System.out.println("I'm here");
      
   }

So the JPanel prints the message "I'm here" before closing it and the JDialog prints the message after closing it.
I need the JPanel to print the message after closing it, how could I do that?