title: Java - Updating JTable with fireTableDataChanged();
body: <p>I  have a JTable in my program. I want to update it after clicking JButton.
  I wrote this:</p>
  
  <pre><code>DefaultTableModel myTable = new DefaultTableModel(celDatas,celNames);
          JTable source = new JTable(myTable){public boolean isCellEditable(int rowIndex, int colIndex) {
    return false;}};
          JScrollPane pane = new JScrollPane(source);
  
  (...)
      start.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e)
          {
                      query = "Select sal FROM EMP";
      myTable =(DefaultTableModel)source.getModel();
                  myTable.fireTableDataChanged();
  }
  </code></pre>
  
  <p>The problem is that id doesn't update my data on JTable.
  How to resolve this problem?</p>
  
  <hr>
  
  <p>EDIT:
  JTable is displayed in my guy through JScrollPane.
  I make now this:</p>
  
  <pre><code>   source = new JTable(myTable){public boolean isCellEditable(int rowIndex, int colIndex) {return false;}};
     pane = new JScrollPane(source);
  </code></pre>
  
  <p>I made also a new void, where is getting datas from database + there I define myTable:</p>
  
  <pre><code>void queryConnection() {
     (...)
          myTable = new DefaultTableModel(celDatas,celNames);
  </code></pre>
  
  <p>}</p>
  
  <p>I added a JButton, which update my JTable (when we change the query.</p>
  
  <pre><code>start.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e)
      {
            query = "Select sal FROM EMP";
            queryConnection();
      }
  }
  </code></pre>
  
  <p>================================================================================</p>
  
  <pre><code>public class Application2 implements Runnable {
  private JTable source;
     private JScrollPane pane;
     private DefaultTableModel myTable;
  
     private JPanel panel;
  
     private String[][] celDatas = null;
     private String[] celNames = null;
  
     public void run() {
  
  
  (...)
  
  
  start.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e)
          {
              if(...) {
  
                  query = "Select sal FROM EMP";
                  queryConnection();
              }
  }
  
  if(query == null) {
              query = "Select * from EMP";
              queryConnection();
          }
  
          source = new JTable(myTable){public boolean isCellEditable(int rowIndex, int colIndex) {return false;}};
          pane = new JScrollPane(source);
          pane.setSize(f.getSize().width-60,300);
          pane.setLocation(30,20);
  
  panel.add(pane);
  f.add(panel);
          f.pack();
  }
  void queryConnection() {
  
  
  //here is connection and downloading datas
  
  myTable = new DefaultTableModel(celDatas,celNames);
  
  }
  </code></pre>
  
  <p>I hope that it is right now more convenient? ;)</p>