title: java - JDialog closing refresh JFrame issue
body: <p>The scenario is that I have a JTable on my JFrame named "MainFrame" and I can edit the data saved in a xml file using a JDialog named "EditFrame". I can change the data in the xml file by click the save button on "EditFrame" but it won't reload the JTable on "MainFrame". The code for MainFrame is as below:</p>
  
  <pre><code>package ca.ism.wen.gui;
  
  import java.awt.BorderLayout;
  import java.awt.Container;
  ...
  import javax.swing.table.AbstractTableModel;
  import javax.swing.table.DefaultTableModel;
  import javax.swing.table.TableModel;
  
  
  public class MainFrame extends JFrame implements ActionListener{
  
      static JTable jt = null;
      static List&lt;RdpServ&gt; rdps = null;
      static Vector&lt;String&gt; header = null;
      static Vector&lt;Vector&lt;String&gt;&gt; data = null;
      static TableModel tm = null;
  
      public MainFrame(){
  
          header = new Vector&lt;String&gt;();
          ...         
          loadData();
  
          jt = new JTable(tm);
  
          Container con = this.getContentPane();
          JScrollPane p = new JScrollPane(jt);
          con.add(p);
  
          JButton btnEdit = new JButton("Edit");
          btnEdit.setActionCommand("Edit");
          btnEdit.addActionListener(this);
          JButton btnLogout = new JButton("Logout");
          btnLogout.setActionCommand("Logout");
          btnLogout.addActionListener(this);
  
          JPanel jp = new JPanel();
          jp.add(btnEdit);
          jp.add(btnLogout);
          con.add(jp, BorderLayout.SOUTH);
  
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setSize(800,600);
          setVisible(true);
      }
  
  
      public void actionPerformed(ActionEvent e) {
          String cmd = e.getActionCommand();
          if (cmd.equals("Edit")) {
              EditFrame ef = new EditFrame();
              ef.addWindowListener(new WindowAdapter(){
              @Override
                  public void windowClosed(WindowEvent e) {
                      refresh();
                  }
              });
          }
          else if (cmd.equals("Logout")) {
              UserDao.signoff();
              System.exit(0);
          }
      }
  
      public static void refresh(){
          loadData();
          jt.repaint();
  
      }
  
      public static void loadData(){
          rdps= UserDao.getRs();
          data = new Vector&lt;Vector&lt;String&gt;&gt;();
          for (RS rdp:rdps){
              Vector&lt;String&gt; v = new Vector&lt;String&gt;();
              ...
              data.add(v);
          }
  
          tm = new DefaultTableModel(data,header){
              public boolean isCellEditable(int row, int column)
              {
                  return false;
              }
          };
  
      }
  }
  </code></pre>
  
  <p>I googled a lot and tried the solution online. None of them works for my code. Please help. Thanks, guys!!!</p>