View Single Post
Old 12-13-2010, 06:21 PM   #1
joebo
Junior Member
joebo began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2010
Device: kindle
jscheme proof of concept

Not sure how useful this is yet, but I have a proof of concept java app running through jscheme on my kindle 3g

howto (short):
1. download jscheme.jar and copy to kindle
2. run java -cp jscheme.jar jscheme.REPL on a root shell
3. paste in the proof of concept scheme code

howto (long):
1. download java 1.4 sdk
2. download jscheme
3. modify EventFrame.java (see attached)
4. run bin\make in jscheme
5. copy jscheme to device

PREREQS:
1. jail break
2. usbnetwork

WHY:
I wanted to be able to develop a simple app/script on the kindle. Scheme seemed like a good choice.

ISSUES:

I can't figure out how to keep the key code from bubbling up to the main window manager. It captures the keys but the main window (behind it) still gets its. For example, if I type abc then the search box still intercepts it too. Any ideas how to prevent that?

SCHEME CODE:



Code:
(import "java.awt.*")
(import "jlib.*")

(define *y* 0) 
(define win (EventFrame. "Hello"))
(define font (Font. "Arial" 1 20))
(.paintHandler$ win (lambda(g) 
  (.setColor g Color.white$)
  (.fillRect g 0 0 600 800)
  (.setColor g Color.black$)
  (.setFont win font)
	(.drawString g (.toString *y*) 10 *y*)
	(.drawOval g  40 50 100 100)
))
(.addKeyListener win 
  (Listener11. (lambda (e) 
    (set! *y* (+ 10 *y*))
    (.consume e) 
    (.setKeyCode e 0) 
    (.println System.out$ e) 
    (.requestFocus win) 
    (.repaint win))))
(.pack win)
(.setSize win 600 800)
(.setFocusableWindowState win #t)
(.requestFocus win)
(.show win)
Attached Thumbnails
Click image for larger version

Name:	kindle scheme.jpg
Views:	426
Size:	73.8 KB
ID:	62780  
Attached Files
File Type: txt EventFrame.java.txt (1.4 KB, 289 views)
File Type: txt jscheme.jar_rename.txt (601.4 KB, 273 views)

Last edited by joebo; 12-13-2010 at 06:25 PM.
joebo is offline   Reply With Quote