This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Low-level access to Java objects - Instantiating Objects
- From: Chris Dean <Chris dot Dean at sokitomi dot com>
- To: roland at motorola dot com
- Cc: kawa at sources dot redhat dot com
- Date: Fri, 11 Jul 2003 19:29:10 -0700
- Subject: Re: Low-level access to Java objects - Instantiating Objects
- References: <3F0F6B00.7000205@motorola.com>
Roland Besserer <roland@motorola.com> wrote:
> I have had a good experience with Jython, which allows Python scripts
> to be run in the JVM with direct access to Java objects. I plan on
> using kawa in a similar fashion.
We call between Java and Kawa extensively (including direct access to
Java objects) with no problems. The docs that Jim mentioned are a good
place to start to see how to call Java from Kawa.
> import javax.swing as swing // associates java package with a name
> win = swing.JFrame("Hello") // calls the JFrame constructor
> win.size = (200,200)
> win.show
I personally like the define-namespace syntax:
(define-namespace JFrame "class:javax.swing.JFrame")
(let ((win (JFrame:new "Hello")))
(JFrame:set-size win 200 200)
(JFrame:show win))
Regards,
Chris Dean