Adding mouse event to java.awt.List
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mel_Lee
Posted On:   Tuesday, April 20, 2004 11:53 AM

Hi, I need help to add a mouse event to a java.awt.List.


I have a database which I have queried from, and the results returned are added to a java.awt.List object and presented on screen.


I need to implement such that when I double-click the mouse on one of the item, it will give me a detailed result.


How do I go about to add the mouse event in?


Many thanks!

Re: Adding mouse event to java.awt.List

Posted By:   shay_te  
Posted On:   Friday, May 21, 2004 12:36 PM

i think i have an idea


public class SList extends List implemets ActionListsner{


privte Vector listsners = new Vector();

public void accMouseListsner(MouseListener m){

if(!listeners.contains(m)){

listeners.add(m)

}

}

public void removeMouseListsner().......


public void actionPerformed(ActionEvent e){

/// here try to see what e.getActionCommand() gives you

/// on mouse selecting a line in List

//if you can track it

if(e.getActionCommand() == ) {

for(int i = 0 ; i < listenmets.size() ; i++){

MouseListenet m = (casting here)listenets.getElementAt(i)

m.mousePressed(new mouseEvet())

}

}

}

}



hopes thats helps



just an idea


shay
About | Sitemap | Contact