Why wouldn't the JDialog have focus? If not, what does have focus? How would the app know that the <ESC> keypress would apply to a component that does not have focus?