I am creating a Swing based application , which actually consist of two buttons as shown below -

now what i want is when first button is clicked it must perform a action like showing a panel containing label, textfields , and some buttons in the same frame as shown below -

and when second button is clicked it will show another panel in the same frame as shown below ..

the thing is i am not understanding how to make this interface in action by providing event handler and action listener .. So please letme me know how can i archive this . Any help would be appreciated .. Thanks