title: Add listener to JPanel that will be only called onload
body: <p>Well the question is pretty straight forward:</p>
  
  <p>In C# WinForms you got a listener on the Winform called onload > <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form.onload%28v=vs.110%29.aspx" rel="nofollow" title="onload winforms">onload winforms</a>. <br />
  This is what I also want to create in my JPanels, because I want to fill my JList with data from the database. <br /></p>
  
  <p><p>
  I tried using the MouseMotionListener but then I need a Timer which controls the select statement to the database, otherwise he would spam the database with the select statement.</p>
  
  <p>I got this code to switch panels:</p>
  
  <pre><code>public void changePanel(String panelRef) {
      ((CardLayout) (getContentPane().getLayout())).show(getContentPane(), panelRef);
  }
  </code></pre>
  
  <p>The panels are instantiated and added in the JFrame.</p>