title: Java: create second frame while clicking on button of first frame
body: <p>In my application one frame is there on which one button is there. If this button is clicked then second frame will open and it will take some data from the client. And after submitting (Submit Button on Second frame) these data, frame will close.I use JFrame for first frame. </p>
  
  <p><strong>Now what I use for the second frame.</strong>   </p>
  
  <p>These type of question previously asked on this site but lot of people say that use JDesktopPane, JDialog and other things. I am confused so please clearly specify what is the right way. currently I am using JFrame for first and second frame. But I know this is bad idea to use two Jframe in one application and second frame also not work in that way which I want.</p>
  
  <p>If your answer is to use JDialog then please mention how I customize this.</p>
  
  <p>I am attaching the look of second frame which help you guy to understand what I want in my application.</p>
  
  <p><img src="https://i.stack.imgur.com/j1D5V.jpg" alt="enter image description here"> </p>