🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.lenguajes.java
Article #25883

Re: Problemas con JList

#25883
From: Socram
Date: Mon, 01 Mar 1999 00:00
49 lines
2093 bytes
gcanales escribi� en mensaje
<36DA51D4.AB87AB9C@a01-unix.gsyc.inf.uc3m.es>...
>�Alguien me podr�a decir como generar el evento del doble click sobre un
>item de una JList, como si se tratase de una List de AWT.???

la solucion a este problema vieve comentada en la API del JList. Dice lo
siguiente:

JList doesn't provide any special support for handling double or triple (or
N) mouse clicks however it's easy to handle them using a MouseListener. Use
the JList method locationToIndex() to determine what cell was clicked. For
example:

 final JList list = new JList(dataModel);
 MouseListener mouseListener = new MouseAdapter() {
     public void mouseClicked(MouseEvent e) {
         if (e.getClickCount() == 2) {
             int index = list.locationToIndex(e.getPoint());
             System.out.println("Double clicked on Item " + index);
          }
     }
 };
 list.addMouseListener(mouseListener);

Note that in this example the JList variable is final because it's referred
to by the anonymous MouseListener class.


>Otra cosa, rela cionada con el mismo tema. Tengo un applet en el que
>utilizo alguna JList, pero al introducir los items en ella (son
>recuperados de Base de Datos), no se me refresca la pantalla y no
>aparecen, hasta
>que no hago algo sobre ella.



para esto a ver si te vale este truquilo:

jlist1.setSize(jlist1.getize())


Saludos:


Socram -----> uov02127@correo.uniovi.es
-------------------------------------------------------------------------
Bajo el nogal de ramas extendidas
yo te vendi y tu me vendiste. George Orwell
Technical Details
Message-ID: <7bf048$b8s$1@diana.bcn.ttd.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36DA51D4.AB87AB9C@a01-unix.gsyc.inf.uc3m.es>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 1116f3,9537e101e52319c2
X-Google-Attributes: gid1116f3,public
From: "Socram" <uov02127@correo.uniovi.es>
Subject: Re: Problemas con JList
Date: 1999/03/01
Message-ID: <7bf048$b8s$1@diana.bcn.ttd.net>
X-Deja-AN: 450230899
References: <36DA51D4.AB87AB9C@a01-unix.gsyc.inf.uc3m.es>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Telefonica Transmision de Datos
Newsgroups: es.comp.lenguajes.java