title: How to repaint my JTable
body: <p>So I have this application with a JTable in it. The JTable is inside of a JScrollPane and JScrollPane is painted on a JFrame.</p>
  
  <p>Now in my application I open a new windows to add a new row to that table and after I click a button to save the changes, the new window closes. </p>
  
  <p>Now I have tried adding these lines after the new window is closed:</p>
  
  <pre><code>askTableInfo(); //a method to save the info in database to table and then save the table to variable 'table'
  table.repaint();
  scrollPane.repaint(); 
  </code></pre>
  
  <p>And of course repaint(); by it self. But it still does not seem to update my table in the JFrame.</p>
  
  <p>What could be the issue here?</p>
  
  <pre><code>public class AppWindow extends JFrame implements ActionListener {
      String user = "";
      JLabel greetText = new JLabel();
      JPanel panel = new JPanel();
      JPanel panel2 = new JPanel(new GridLayout(1, 3));
      JScrollPane scrollPane;
      JTable tabel;
      JButton newBook = new JButton("Add a book");
      JButton deleteBook = new JButton("Remove a book");
      JButton changeBook = new JButton("Change a book");
      int ID;
  
      public AppWindow(String user, int ID) {
          this.ID = ID;
          this.user = user;
          setSize(500, 500);
          setTitle("Books");
  
          setLayout(new BorderLayout());
          greetText.setText("Hi "+user+" here are your books:");
          add(greetText, BorderLayout.NORTH); 
  
          askData();  
          panel.add(scrollPane);
          add(panel, BorderLayout.CENTER);
  
          panel2.add(newBook);
          panel2.add(deleteBook);
          panel2.add(changeBook);
          add(paneel2, BorderLayout.SOUTH);
  
          newBook.addActionListener(this);
  
          setVisible(true);
      }
  
      private void askData() {
          DataAsker asker = null;
          try {
              asker = new AndmeKysija(ID);
          } catch (SQLException e) {
              e.printStackTrace();
          }
          table = asker.giveTable();
          scrollPane = new JScrollPane(tabel);
      }
  
      public static void main(String[] args){
          AppWindow window = new AppWindow("Name", 2);
      }
  
      @Override
      public void actionPerformed(ActionEvent e) {
          if(e.getSource() == newBook){
                  new BookAdded(ID);
                  panel.revalidate();
                  panel.add(scrollPane);
                  panel.repaint();
                  repaint();
          }   
      }
  }
  </code></pre>