I put activate() and deactivate() inside an block if SwingUtilities.invokeLater, but this did not solve it.
I have another, maybe the same, problem with this part of code:
in the first line, a dialog is opened. In this dialog, when the user clicks on Ok, something is loaded from the database (or sometimes not). If loading was successfull, the class, in which the dialog is instantiated, calls _loadDialog.success(), so the dialog knows it can close itself.
BUT: At this point _loadDialog is null. I already found out the reasing: The dialog is modal. In this case, the field _loadDialog is filled with the object _after_ the dialog is closed.
How can i change my code to have the dialog still modal, but fill the field _loadDialog before it is called?