JList/MouseListener  
Author Message
Roman Thurnherr





PostPosted: 2003-8-10 19:06:00 Top

java-programmer, JList/MouseListener Hi all
I'm using two JLists with the same MouseListener in a JFrame. How can I find
out on which JList the MouseEvent was released?
Is it generally possible or should I use a MouseListener for each JList?
Thanx for your help
Roman


 
sgilbert





PostPosted: 2003-8-11 4:11:00 Top

java-programmer >> JList/MouseListener "Roman Thurnherr" <email***@***.com> wrote in message news:<3f3626a4$email***@***.com>...
> Hi all
> I'm using two JLists with the same MouseListener in a JFrame. How can I find
> out on which JList the MouseEvent was released?
> Is it generally possible or should I use a MouseListener for each JList?
> Thanx for your help
> Roman
Hi,
Assuming that you have some way of telling which JList is which, like this:

private JList leftList...
private JList rightList...

then you should be able to tell which list received the "up"
event by writing:

public void mouseReleased(MouseEvent e)
{
if (e.getSource() == leftList) ...
else ... // must be rightList
}

--Steve