Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MouseOver

Posted on 2004-04-28
8
Medium Priority
?
319 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
Technology Partners: 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!

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

610 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