OK here we go again. Steve has to program another non-standard set of key strokes. We have an editable JTextPane embedded in a JScrollPane. This pane correctly handles the Up and Down arrow keys, but I can't figure out how. If I could figure out how, I could implement the nonstandard things I need to implement.
Specifically, because the PageDown key is globally mapped to doing another function we don't do the default actions for PageUp, PageDown,Ctrl-PageUp and Ctrl-PageDown. Instead we want to map these functions to the shifted arrow keys, not the ones on the numeric keypad.
Specifically in the JScrollPane class's ancestor input map ((InputMap)UIManager.get("ScrollPane.ancestorInputMap");) we add the
- Shifted Down Arrow key to the Ancestor input map pointing to the"scrollDown" action
- Shifted Up Arrow key to the Ancestor input map pointing to the "scrollUp" action
- Shifted Left Arrow key to the Ancestor input map pointing to the "scrollHome" action
- Shifted Right Arrow key to the Ancestor input map pointing to the "scrollEnd" action
None of these keystrokes do anything. I'vwe even overridden the processKeyEvent() and processKeyBinding() methods of JComponent to log what was going on, and I find that these methods are never fired by these keystrokes. Also, the plain standard up arrow and down arrow keystrokes do not fire these methods, even though these keystrokes do work.
So it seems clear that something else is handling these keystrokes. But what component is that? And yes, the text pane does have focus when I am trying this.