From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99786 invoked by alias); 2 Nov 2018 05:08:30 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 99768 invoked by uid 89); 2 Nov 2018 05:08:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Nov 2018 05:08:28 +0000 Received: from [10.9.9.212] (helo=mailfront12.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1gIRh2-0005p5-7K; Fri, 02 Nov 2018 06:08:24 +0100 Received: by mailfront12.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1gIRgs-0004H4-9H; Fri, 02 Nov 2018 06:08:14 +0100 Subject: Re: Need some help with Java - Kawa interop To: Arie van Wingerden , kawa@sourceware.org References: From: Per Bothner Message-ID: Date: Fri, 02 Nov 2018 05:08:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-q4/txt/msg00024.txt.bz2 On 11/1/18 6:44 AM, Arie van Wingerden wrote: > 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))) nextInt is not static method, so you need an instance. (define (randomColor) (let* ((rnd (java.util.Random)) (r (rnd:nextInt 255)) (g (rnd:nextInt 255)) (b (rnd:nextInt 255))) (java.awt.Color r g b))) -- --Per Bothner per@bothner.com http://per.bothner.com/