Use final local instead of member variable, add instanceof for JDialog.

Code review suggestions implemented.