I couldn't find a concise answer about the relationships among all these, so that I can pick up best practices and get going. JTextComponent has:
The old
addKeyListener(..). We write aKeyListenerwith methods that get called onkeyPressed(..),keyTyped(..), etc. events, which we can query:event.getKeyCode().addKeymap(..)andsetKeymap(..). AKeymaphasaddActionForKeyStroke(..), which takes aKeyStroke(that we can get by callingKeyStroke's static methods specifying the character or key code), and anAction, which is anActionListenerwith bells and whistles.getInputMap(..)andgetActionMap(..). AnInputMapmaps aKeyStroke(as above) to aString, and theActionMapmaps the string to anAction(as above). The Java Tutorial How to use key bindings talks about that.
These are three redundant ways of attaining the same functionality. Besides comparative advantages/disadvantages, this raises the natural question of how these three mechanisms co-exist? Which ones take priority over others?