title: Dynamically remove Component from JPanel
body: <p>I am adding and deleting components dynamically in a <code>JPanel</code>.
  Adding and deleting functionality works fine but when I delete the component it deletes the last component rather than the component to be deleted.</p>
  
  <p>How can I solve this issue?</p>