From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11939 invoked by alias); 16 Dec 2016 21:46:27 -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 11483 invoked by uid 89); 16 Dec 2016 21:46:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=kawa, bird, Bird, claude X-HELO: homiemail-a22.g.dreamhost.com Received: from sub3.mail.dreamhost.com (HELO homiemail-a22.g.dreamhost.com) (69.163.253.7) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Dec 2016 21:46:16 +0000 Received: from homiemail-a22.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTP id 43C60114066; Fri, 16 Dec 2016 13:46:15 -0800 (PST) Received: from vereq.eip10.org (cpe-74-75-122-130.maine.res.rr.com [74.75.122.130]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: chaw@eip10.org) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTPSA id 1BF9B114057; Fri, 16 Dec 2016 13:46:15 -0800 (PST) Received: from chaw by vereq.eip10.org with local (Exim 4.84_2) (envelope-from ) id 1cI0KP-0002b3-2H; Fri, 16 Dec 2016 16:46:09 -0500 To: Claude Marinier cc: kawa@sourceware.org Subject: Re: documentation for Swing - Java data From: "Sudarshan S Chawathe" Reply-To: "Sudarshan S Chawathe" In-reply-to: Your message of "Fri, 16 Dec 2016 16:15:22 -0500." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9983.1481924769.1@vereq.eip10.org> Date: Fri, 16 Dec 2016 21:46:00 -0000 Message-ID: <9984.1481924769@vereq.eip10.org> X-IsSubscribed: yes X-SW-Source: 2016-q4/txt/msg00082.txt.bz2 > From: Claude Marinier > Date: Fri, 16 Dec 2016 16:15:22 -0500 > I am experimenting with Kawa and Swing. I need to provide choices to > a JComboBox and have not found documentation on how to pass data to > Java/Swing. > > Where can I find this? I'm not sure if I understand the question fully, but in general it is easy to call Java constructors and methods from Kawa, and similarly to pass Scheme data to Java via implicit or explicit conversion. The chapter titled "Object, Classes and Modules" in the Kawa manual has many useful details in this regard. (The "lambda as shorthand for an anonymous class"/SAM-conversion is one of my favorite features, especially when using Swing.) A bit more specific to your question perhaps, the code fragment in the JComboBox tutorial at https://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html i.e.: String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" }; //Create the combo box, select item at index 4. //Indices start at 0, so 4 specifies the pig. JComboBox petList = new JComboBox(petStrings); petList.setSelectedIndex(4); petList.addActionListener(this); may be written in Kawa along the following lines: (let* ((pet-strings (String[] "Bird" "Cat" "Dog" "Rabbit" "Pig")) (pet-list (javax.swing.JComboBox pet-strings))) (pet-list:setSelectedIndex 4) (pet-list:addActionListener (this))) assuming it occurs in the the scope of a define-simple-class or equivalent so that the (this) makes sense. Regards, -chaw