By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,727 Members | 766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,727 IT Pros & Developers. It's quick & easy.

JList/MouseListener

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Roman Thurnherr" <no*****@noemail.noemail> wrote in message news:<3f********@news.swissonline.ch>...
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
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.