Alexander Stoddard wrote:

The Swing callback examples (either with or without button_pressed being native) doesn't quite work with the JNI. The StopCallbackLoop() isn't properly ending the callback loop.The button remains visible and can be clicked one more time. This second click hangs the script with the button depressed and it appears button_pressed isn't called a second time.

Alex,

As wierd as this may sound, this is actually "normal" behavior (with these examples anyway).

When you are not using JNI, the control returns to Perl after StopCallbackLoop() and Perl exits,
and terminates the JVM.


But when you are in JNI, the control returns to Perl after StopCallbackLoop() and the main thread
(the one in which Perl is running) exits, but the Swing event thread (or whatever it's called) is still
running and keeping the JVM alive. That's why the button is still available to click once. If you notice
there is actually no code to close the window (I don't know how to do that in Swing..:)


If you know Swing maybe you can give me a hand to make the example better...


Patrick --

=====================
Patrick LeBoutillier
Laval, Quebec, Canada



Reply via email to