This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Newbie question
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/