java swings to display different panel in same frame (java)
<p>the below given is a java class which get invoked on clicking "next" button in first frame .and i send a parameter is i send getContentPane() to this given below program , here ill access the parameter and set its visibality to false , here i use "Back" button to go to previous page dats for ma first frame , but on clicking Back its not showing the previous frame for me , plz help me out with dis </p>

<p>its just a simple program , if i need to take some text input from second frame and again i need to come back to home screen so, how can i achieve this in this program</p>

<pre><code>  public class firstframe extends JFrame{

 public firstframe()
 {
    getContentPane().setLayout(null);

    JButton next=new JButton("Next");
    next.setBounds(100,100,100,100);
    getContentPane().add(next);


    next.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent ev){

            Container c=getContentPane();

        }
         new signup(c);
    }); 
  }
   public static void main(String ar[]){
   firstframe f=new firstframe();
     f.setVisible(true);
    f.setSize(1365,740);
f.show();
</code></pre>

<p>} 
}</p>

<pre><code>public class signup extends JFrame{

    public signup(Container d)
    {
        final Container c=d;
        c.setVisible(false);
        final Container e;
        e=c.getParent();
        e.setLayout(null);
        JButton back=new JButton("Back");
        back.setBounds(100,100,100,100);
        e.add(back);
        e.setVisible(true);


        back.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent ev){
                e.setVisible(false);
                d.setVisible(true);
            }

        }); 
    }
}//
</code></pre>
