0

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.

Now what I use for the second frame.

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.

If your answer is to use JDialog then please mention how I customize this.

I am attaching the look of second frame which help you guy to understand what I want in my application.

enter image description here

Vinit ...
  • 1,409
  • 10
  • 37
  • 66
  • Why can't you just open a new `JFrame`? – Hunter McMillen Mar 26 '12 at 06:13
  • there is no problem to open JFrame into other Jframe. See this http://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice here some people say taht this is bad idea to use two Jframe in one application – Vinit ... Mar 26 '12 at 06:24
  • *"If your answer is to use JDialog then please mention how I customize this."* Do whatever you did in a frame, but starting with a dialog! There will be some slight differences (e.g. a dialog would usually have a parent) but until you ask a more specific question, I can give you no more specific an answer. – Andrew Thompson Mar 26 '12 at 06:24

2 Answers2

4

Use JDialog and make it modal. So when you call it you can process all the results just after cloging it in the same method.

StanislavL
  • 56,971
  • 9
  • 68
  • 98
1

If you are using two frames then in the second frame use setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); instead of setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Arun Agarwal
  • 787
  • 6
  • 10