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