This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Low-level access to Java objects - Instantiating Objects


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]