title: repaint(), revalidate(), invalidate(). How to use them?
body: <p>I have problem with display of table. My table initially has rows. But next time if I do some operation my table list becomes empty. So when I add that model to the table the table is empty. It is <code>empty</code> but the display is showing white colour in table area.</p>
  
  <p>Initially the table looks like below figure. </p>
  
  <p><img src="https://i.stack.imgur.com/zcqFz.png" alt="First Table"></p>
  
  <p>Then I need to call some action and if that action returns an empty list then I am creating a new 
  Jtable with that list and placing it on the panel. But it is looking like the following.</p>
  
  <p><img src="https://i.stack.imgur.com/j9V0s.png" alt="Empty Table"></p>
  
  <p>Following is the approach which I am follwoing to do this,</p>
  
  <pre><code>pnlRight.removeAll();
  //pnlRight.invalidate();
  // pnlRight.revalidate();
  // pnlRight.repaint();
  pnlRight.add(new JScrollPane(table), BorderLayout.CENTER);
  pnlRight.invalidate();
  pnlRight.validate();
  pnlRight.repaint();
  </code></pre>
  
  <p>I have read one of the post on this <a href="https://stackoverflow.com/questions/1097366/java-swing-revalidate-vs-repaint">@kdgregory</a>, after removing I should call the above methods. this weird thing is happening. If I call only repaint() then even the column names are missing from the panel (Ideally this should not happen in this case.) Please explain what is the problem with this.</p>