I have a program where a list of certain objects is constructed from a file. A graphical representation of the frist object in the list is drawn inside a JPanel. Now I would like to navigate the list using the keyboard, for instance the up and down arrows, and I am reading up on KeyListener and keybindings. I am a little confused. Is it correct that you use keybindings when you already have some menu/mouse action in place and just want to use keyboard as shortcut while KeyListener is for when you start from bottom like in my case ?
A Key Binding is used when you want to listen for a specific KeyStroke as oppose to any KeyStroke. So listening for up/down/left/right are specific KeyStrokes. If you want to listen for a large group of KeyStroke, say all the letters of the alphabet, then you would probably use a KeyListener rather than writing 26 key bindings.
So, in general you should always use Key Bindings. Swing was designed to use Key Bindings.
Old AWT applications used KeyListeners because Key Bindings didn't exist back then.