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)
On JFrame B i have 4 JPanels Placed on JTabbedPane. Each JPanel has 2 JButtons.
I'm trying to hide JFrame B when i click Jbutton on JPanels and show Jframe A again.
How do I do this?
// JPanel Class
public class AddItemPanel extends javax.swing.JPanel {
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
}
}
}
// JFrame Class
public class ItemFrame extends javax.swing.JFrame {
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());
}
}