title: Repainting JPanel after button click
body: <p>I'm new in Java Swing and I have a strange problem to refresh my <code>JPanel</code>. </p>
  
  <p>I create a static <code>JPanel</code> componant in my frame and I call a static method from a <code>FileListenner</code> to repaint my <code>JPanel</code></p>
  
  <pre><code> public static void repaintPlan(JPanel f) {
      f.paint(f.getGraphics()); 
      f.revalidate(); // or validate
  }
  </code></pre>
  
  <p>I mean, when I detect change in file content, I calculate the new coordinates and I repaint the <code>JPanel</code> (I create a class exends from <code>JPanel to define</code>paintComponent()` method)</p>
  
  <p>Everything is working fine when I run the app, and the repaint works when a change data in file; but if I click with my mouse in the <code>Jpanel</code>, the <code>repaint()</code> method  doesn't work anymore. Can you tell me why after clicking on <code>JPanel</code>, repainting doesn't work ?</p>
  
  <p>Sorry for my bad english
  Thanks in advance:)</p>
  
  <p>Edit: Thanks for your repsonses! But even if I use <code>repaint()</code> method, it's the same problem. I'm trying to understand what happens when I click on <code>JPanel</code>. Should I use mouse events in Swing to solve the problem?</p>