?
Solved

MouseOver

Posted on 2004-04-28
8
Medium Priority
?
316 Views
Last Modified: 2010-03-31
Hi,

I want to create a mouseOver method that changes an images when the cursor is over an image on my interface.  What is the easiest way to do this?  The images are set at certin co-ordinates.

Thanks in advance

Garth
0
Comment
Question by:garth15
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 10938939
Keep an array of images, change them in the mouse over event, calling repaint
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10938949
It may help if you were to go into more detail of what you want though...
0
 

Author Comment

by:garth15
ID: 10938980
Well I have a chat interface which has bodies on it.  When a user puts his or her cusor over on of these bodies I want the body colour to change.  When they exit the body then for the body to change back to the colour it started at.  I paint the bodies on the interface when they join the chat room via the paint mehtod which uses double buffering and an update method.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 86

Expert Comment

by:CEHJ
ID: 10939003
OK, so it sounds like you need to add the mouse listener to this container, determine which body is at the mouse coordinates, change the Paint color of that body and then call repaint
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 10939063
You can get the Rectangle of each body and in the mouse listener do something like:

if (body1.getRectangle().contains(new Point(mouseEvent.getX(),mouseEvent.getX())) {
      // set paint red
}
else {
      // set paint blue
}      
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10939070
(calling repaint at the end, after testing each one)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10939838
8-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month11 days, 11 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question