This is the mail archive of the kawa@sourceware.org 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: Subclassing Swing in Kawa


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/


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