title: Hide/Show JFrame using Jbutton on JPanel
body: <p>In my Swing application I have 2 JFrame A and B. When I click button on JFrame A, It opens JFrame B and hide itself(I managed to do that part)</p>
  
  <p>On JFrame B i have 4 JPanels Placed on JTabbedPane. Each JPanel has 2 JButtons. </p>
  
  <p>I'm trying to hide JFrame B when i click Jbutton on JPanels and show Jframe A again.</p>
  
  <p>How do I do this?</p>
  
  <p>// JPanel Class</p>
  
  <p>public class AddItemPanel extends javax.swing.JPanel {</p>
  
  <pre><code>  public AddItemPanel() {
          initComponents();
    }
  
    private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {                                          
  
        if(evt.getSource() == btnCancel)
        {
          ItemFrame d = new ItemFrame();      
               d.setVisible(false);// not working
               this.setVisible(false);// not working
        }
  }
  </code></pre>
  
  <p>}      </p>
  
  <p>// JFrame Class</p>
  
  <p>public class ItemFrame extends javax.swing.JFrame {</p>
  
  <pre><code>  public ItemFrame() {
  
          initComponents();
          jTabbedPane1.add("Add Items",new AddItemPanel());
          jTabbedPane1.add("Delete Items",new DeleteItemPanel());
          jTabbedPane1.add("Update Items",new UpdateItemPanel());
          jTabbedPane1.add("Search Items",new SearchItemPanel());
   }
  </code></pre>
  
  <p>}</p>