• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

MouseOver

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
garth15
Asked:
garth15
  • 6
1 Solution
 
CEHJCommented:
Keep an array of images, change them in the mouse over event, calling repaint
0
 
CEHJCommented:
It may help if you were to go into more detail of what you want though...
0
 
garth15Author Commented:
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.

 
CEHJCommented:
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
 
CEHJCommented:
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
 
CEHJCommented:
(calling repaint at the end, after testing each one)
0
 
CEHJCommented:
8-)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now