The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Mouse Listeners

Posted by Zach Keatts on November 08, 2001 at 1:00 PM

I want to do several different functions with several Labels in my program. I added mouse listener's to each one of them writing

disCard.addMouseListener(this);
userCard.addMouseListener(this);
userCard2.addMouseListener(this);

What I want to do is when the mouse enters only a certain object do a manipulation on only that object (userCard1, and userCard2).

It seems I will have to make an if statement, but how will I do that? I can't write

if(userCard.MouseEntered(this))
{
etc...
}

How do I get the MouseEntered method to recognize exactly which object it has entered, and be able to differentiate so that I can do specific operations on different objects?
All the examples I have found on the net are the same thing, and they all apply to applets.

Thank you for any help,

-Zach Keatts




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us