-1

I have a MyDialog which extends JDialog, when I close the MyDialog it will take a time around 30 - 45 seconds. MyDialog is a child form of my main form which is JFrame and until MyDialog is closed the focus can not come to main window. What will be the reason that MyDialog take time to close the dialog?

For close operation I am setting:

setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE)
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Mahmood
  • 52
  • 1
  • 6

1 Answers1

3

Almost always problems like this are because you are doing something that takes a long time in the EDT thread. What do you do after the dialog is closed? Do you take actions based on the button the user clicked? Make sure these actions execute quickly or in a new thread.

Garrett Hall
  • 29,524
  • 10
  • 61
  • 76