title: How to find if JPanel has null components?
body: <pre><code>if (cardPanel.getComponent(0) != null) cardPanel.remove(0);
  </code></pre>
  
  <p>I need to remove anything potentially on the cardPanel which is a JPanel...
  if there is nothing then it should not attempt to remove.</p>