Article View: borland.public.jbuilder.java.api
Article #3230Re: Basic listbox question
From: Paul Furbacher
Date: Thu, 19 Mar 1998 00:00
Date: Thu, 19 Mar 1998 00:00
43 lines
2216 bytes
2216 bytes
Caren Boroshok wrote: > I'm working with a simple listbox and trying to handle double clicks > specially. I figured out how to use the getClickCount to see if the > user double-clicked, but how can I tell which item in the list he > double-clicked on. It seems the event will give you an X-Y position, > but how can I translate this into an index in the listbox?? > Seems like it should be obvious... Finding the answer involves a good deal of tracking through the on-line docs: In the on-line help, you have to click on the "Event listeners" which will take you to a list of listeners. Click on "selection". That takes you to where you can click on "borland.jbcl.model. VectorSelectionListener" link. That takes you to a discussion of the VectorSelectionListener interface. Page down once to see the methods defined: selectionChanged, etc. You want to read about selectionChanged. Then, you want to read about "VectorSelectionEvent" which will give you the info on how you get which item was selected (i.e., either the "location" for single item selection, or the "selection" property for multiple-item selection). In the case of multiple-selection, you have to follow the link to "VectorSelection". Read about "getAll()". Then, after that, go back to the designer, focus the "Events" tab, and double- or triple- click on the "selectionChanged" line. That will create the method, and you can fill it in with your newly gained knowledge from the docs. Incidentally, this is a question better suited for the JBCL group. Paul Furbacher
Technical Details
Message-ID:
<351137A5.2B86BC8B@bilbo.bio.purdue.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<351070D4.90E@securitydynamics.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,1491cdcbeb54ef2e X-Google-Attributes: gid1089d0,public From: Paul Furbacher <pf@bilbo.bio.purdue.edu> Subject: Re: Basic listbox question Date: 1998/03/19 Message-ID: <351137A5.2B86BC8B@bilbo.bio.purdue.edu> X-Deja-AN: 335695682 Content-Transfer-Encoding: 7bit References: <351070D4.90E@securitydynamics.com> Mime-Version: 1.0 Reply-To: pf@bilbo.bio.purdue.edu To: cboroshok@securitydynamics.com Content-Type: text/plain; charset=us-ascii Organization: Biological Sciences, Purdue Univ. Newsgroups: borland.public.jbuilder.java.api