🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19645

Re: ListControl Component...

#19645
From: Joe Nuxoll
Date: Wed, 07 Jan 1998 00:00
23 lines
1256 bytes
Troy DesBarres wrote:
> If I add a SelectionListener to a ListControl Component can I then get
> the index of whatever item is selected.  I don't want the string I want
> to know what is the index of that selected String.  Help.... I am truly
> stuck.

public void listControl1_selectionItemChanged(VectorSelectionEvent e) {
  if (e.getChange() == e.ITEM_ADDED) {
    // here it is...
    int index = e.getLocation();
  }
}

Are you sure you don't want to listen to subfocus events instead?  If
you just want to know when the 'current' item in the list changes:

public void listControl1_subfocusChanged(VectorSubfocusEvent e) {
  // here it is...
  int index = e.getLocation();
}

 - Joe Nuxoll
Technical Details
Message-ID: <34B3E5E7.CD30A001@corp.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34B341F8.68DA00B5@whitehouse.acl.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,9e0160d5f2af2230
X-Google-Attributes: gidf74b3,public
From: Joe Nuxoll <jnuxoll@corp.borland.com>
Subject: Re: ListControl Component...
Date: 1998/01/07
Message-ID: <34B3E5E7.CD30A001@corp.borland.com>
X-Deja-AN: 313715330
Content-Transfer-Encoding: 7bit
References: <34B341F8.68DA00B5@whitehouse.acl.ca>
Content-Type: text/plain; charset=us-ascii
Organization: Borland International, Inc.
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language