I’m implementing a JPanel inside a JScrollPane, and I want the panel to respond to arrow keys. Unfortunately, pressing arrow keys resulted in the JScrollPane scrolling. If you’re pulling out your hair trying to block JScrollPanes from responding to arrow key events, check out this:
Swing – Disabling of JScrollPane key binding.
Implement this message, and you can prevent the JScrollPane from automatically scrolling.