Yes, it's Java.
I think all you need to modify is this file:
https://code.google.com/p/kindle-cs/...ispatcher.java
Drop all the code that is not useful for your goal.
To simulate 5-way keypresses, you'll have to open "file" /proc/fiveway and write strings like "send 108\n" to it.
Code:
103 = Up
108 = Down
105 = Left
106 = Right
194 = Select
If it's beyond your hacking abilities, I can do it for you.