🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12430

Re: How to select items in JList without CTRL?

#12430
From: Anne JANSSENS
Date: Tue, 12 Jan 1999 00:00
23 lines
1146 bytes
You have three kind of events that occured on a JList (in that order) :
    - keyEvent
    - ListEvent
    - MouseEvent

If you are familiar with event handler, you can add a MouseListener to your
JList and
add action on mouse click like this :

my_list.addMouseListener(new MouseHandler()
{
     public void mouseClicked(MouseEvent evt)
     {    /* eg : 2 clicks on you item select it */
          if (evt.getClickCount()==2)
          {    /* get the item selected */
               int num_item=this.locationToIndex(new
Point(evt.getX(),evt.getY()));
          }
    }
}
);

Hope it could help you :) Anne
Technical Details
Message-ID: <77fnol$pt118@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <369B51D7.8B9CEEF5@cit.org.by>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,779a1f6cb4c8909d
X-Google-Attributes: gid111d45,public
From: "Anne JANSSENS" <recherche@generix.fr>
Subject: Re: How to select items in JList without CTRL?
Date: 1999/01/12
Message-ID: <77fnol$pt118@forums.borland.com>
X-Deja-AN: 431680426
References: <369B51D7.8B9CEEF5@cit.org.by>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing