Hi Tomas,
> I just looked at how I implemented 'jproxy' in wl interpreter. I
> experimented with several things how to use event listeners.
> ...
> - Much better was writing a function handler (see swt3.l example) which
> basically does curry, e.g.
Yes, that's also how I did it in one test, e.g. using the Frame object
to hide it. I directly used the Lisp 'curry' function:
(java Button "addActionListener"
(interface "java.awt.event.ActionListener"
'actionPerformed
(curry (Button Frame) (Ev)
(java Frame "hide")
...
This issue is not a real problem. It would just have been convenient if
the object would have been passed in directly from the JVM. But I
understand now that this is not possible for the Java runtime, in the
way methods are invoked (as opposed to PicoLisp's prefix classes).
> We also discussed on IRC, how to define the 'paint' method on JPanel. I
> haven't looked whether it's possible to use an "interface" proxy somehow
> without the need for compiling some stub class for "class" proxy (as
> opposed to java "interface" proxy). If not, that's a limitation of
> Swing. In SWT, it is possible; see swt2.l example:
>
> (S 'addPaintListener (jproxy NIL 'onPaint PaintListener))
I see. But this is because you are using PaintListener from Eclipse,
which is not available in a normal runtime environment.
The limitation of not being able to define a "class" proxy is more one
of the JVM Proxy than just of Swing, it seems. Proxy.newProxyInstance()
doesn't accept a normal class, just an interface.
> Hope it helps,
Yes, thanks!
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=unsubscribe