0

I have such situation: I need to stop executing of code while i show custom JFrame. So, I have main frame where I call another frame:

CreateDialog _create = new CreateDialog("Project");
_create.CreateProject();            
JOptionPane.showMessageDialog(_create, "Yes");

where CreateProject extends JFrame and has some info, textareas and control buttons. So i wanna see MessageDialog when i close CreateDialog frame, but it shows me CreateDialog frame MessageDialog over it. How can I hold code execution while CreateDialog is running?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
vadimaid
  • 3
  • 1
  • 4
  • 2
    What you need is a modal dialog, not a another frame. See [How to Use Modality in Dialogs](https://docs.oracle.com/javase/tutorial/uiswing/misc/modality.html). Also, don't use `_` in non-final variables, and method names should start with a lowercase. – user1803551 Jun 26 '16 at 11:24
  • 1
    See also [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) (but @user1803551 has already identified the best approach.) – Andrew Thompson Jun 26 '16 at 12:13

0 Answers0