This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Subclassing Swing in Kawa
- From: Per Bothner <per at bothner dot com>
- To: Nigel Dolby <nigel_dolby at acm dot org>
- Cc: kawa at sources dot redhat dot com
- Date: Fri, 28 Apr 2006 12:06:45 -0700
- Subject: Re: Subclassing Swing in Kawa
- References: <445220A0.2030205@acm.org>
Nigel Dolby wrote:
((DiamondIcon (color :: <java.awt.Color>)) :: <DiamondIcon>
(invoke (this) color #t DEFAULT_WIDTH DEFAULT_HEIGHT))
((DiamondIcon (color :: <java.awt.Color>) (selected :: <boolean>)) ::
<DiamondIcon>
(invoke (this) color selected DEFAULT_WIDTH DEFAULT_HEIGHT))
((DiamondIcon (color :: <java.awt.Color>) (selected :: <boolean>)
(width :: <int>) (height :: <int>)) :: <DiamondIcon>
(slot-set! (this) 'color color)
(slot-set! (this) 'selected selected)
(slot-set! (this) 'width width)
(slot-set! (this) 'height height)
(invoke (this) 'initPolygon))
These are not constructor definitions in Kawa. You need
to use the special *init* name.
Furthermore, a constructor call using keywords like:
(make 'DiamondIcon
color: (static-field <java.awt.Color> 'RED
selected: #t width: 24 height: 24))
[aside: CVS Kawa gets confused when you use 'red, since
it also matches the getRed non-static method. This is a
Kawa bug.]
This assumes a default constructor, and then the named
properties are set using the keywords.
So what you want is:
((*init*)
(invoke (this) 'initPolygon))
or if you use CVS Kawa just plain:
((*init*)
(initPolygon))
Then it works.
--
--Per Bothner
per@bothner.com http://per.bothner.com/