Gautam,
When you maximize this frame, the following actions are done:
1. change frame's size - setSize(max,max);
2. redraw it.
It's similar to your code:
setSize(500,500);
setVisible(true);
Button also appears when you resize the frame
Maybe there are some redrawing problems, because when you minimize/restore this frame - it's still empty.
I can suggest you to read RHE or KM about frame.
With best regards,
Jamal Hasanov
www.j-think.com