java - InputMap/ActionMap does not work after opened SubDialog -


i have tried make dialog close when press esc , accept when press enter. have build superclass "closeabledialog" using input/actionmap this:

    getrootpane().getinputmap().put(keystroke.getkeystroke(keyevent.vk_enter, 0), "accept");     getrootpane().getactionmap().put("accept", acceptaction);      getrootpane().getinputmap().put(keystroke.getkeystroke(keyevent.vk_escape, 0), "cancel");     getrootpane().getactionmap().put("cancel", cancelaction); 

now built several dialogs extending closeabledialog. works aspected @ first time (closing when pressing esc, accepting when press enter), when opened subdialog (dialog in dialog) subdialog closeable pressing esc (esc -> subdialog closes, other dialog visible -> esc-> nothin happens).

any ideas?

i think, diposed subdialog gets still inputs of other dialog, not sure.

the shorcuts work when components focused.i think focus not there in opened window.try focus window need shortcut worked fine.try cliking on window , apply shortcut.perhaps work.otherwise have deal get focus window


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -