This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Newbie question
Ok. Thaks for your help. Defining
(define window :: jswing (make jswing))
solved the warning issues. Now, the 2nd. part of the problem, i.e.,
[@ ~]$ java test
Exception in thread "main" java.lang.NoClassDefFoundError: test
was just a matter of including my homedir (where test.scm lives) in
the CLASSPATH.
Best regards and thanks again
Julian
On Fri, Feb 22, 2008 at 5:28 PM, Per Bothner <per@bothner.com> wrote:
> Julian Simo wrote:
>
> > (define-namespace jswing "class:javax.swing.JFrame")
> > (set! window (make jswing))
> > (window:setSize 400 200)
> > (window:setVisible 't)
>
> Works for me, with the latest sources from Subversion.
> I recommend using those, until I get time for an actual release
> (soon after JavaOne, I hope).
>
>
> > [@ ~]$ kawa --main -C test.scm
> >
> > it will produce the following error messages
> >
> > (compiling test.scm to test)
> > test.scm:3:1: warning - no known slot 'setSize' in java.lang.Object
> > test.scm:4:1: warning - no known slot 'setVisible' in java.lang.Object
>
> Yes, because it doesn't know the type of window.
>
> Try:
> (define window :: jswing (make jswing))
>
> I recommend defining the namespace this way:
>
> (define-namespace jswing <javax.swing.JFrame>)
> or
> (define-alias jswing <javax.swing.JFrame>)
> or
> (define-alias jswing javax.swing.JFrame)
>
> The former is sort-of a hybrid between define-alias and
> define-namespace. I posted a summary of the differences between
> them a few says ago on this list. I think one of the things
> I should do before the actual release is clean up the documentation
> to reduce the confusion and redundancy.
>
> I think from now on the recommended "idiom" should be:
> (define-alias jswing javax.swing.JFrame)
>
> You could also do:
> (jswing:new)
> or just
> (jswing)
> rather than
> (make jswing)
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
>
--
Julian