This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Need some help with Java - Kawa interop
- From: Arie van Wingerden <xapwing at gmail dot com>
- To: kawa at sourceware dot org
- Date: Thu, 1 Nov 2018 14:44:47 +0100
- Subject: Need some help with Java - Kawa interop
Trying to generate a random color for a shape in JavaFX.
This (lines 7-9 are the binding of r, g and b):
> (define (randomColor)
(let (
(rnd (java.lang.Math:random))
(r (java.util.Random:nextInt 255))
(g (java.util.Random:nextInt 255))
(b (java.util.Random:nextInt 255)))
(Color:rgb r g b)))
Generates warnings:
.\test.scm:7:34: warning - type integer is incompatible with required type
java.util.Random
.\test.scm:8:34: warning - type integer is incompatible with required type
java.util.Random
.\test.scm:9:34: warning - type integer is incompatible with required type
java.util.Random
.\test.scm:7:8: warning - cannot convert literal (of type gnu.math.IntNum)
to ClassType java.util.Random
.\test.scm:8:8: warning - cannot convert literal (of type gnu.math.IntNum)
to ClassType java.util.Random
.\test.scm:9:8: warning - cannot convert literal (of type gnu.math.IntNum)
to ClassType java.util.Random
What am I doing wrong?
TIA