Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MouseOver applet

Posted on 1997-06-23
1
Medium Priority
?
419 Views
Last Modified: 2011-10-03
I am asking this question again, because I might not have been clear enough the first time. I am looking for code that will change an image/picture to another picture when the mouse enters the area of the picture. The picture should change back after the mouse leaves the area. Also, the images need to be linked to a different URL site. Please help!!
0
Comment
Question by:pinto
1 Comment
 
LVL 2

Accepted Solution

by:
webster030697 earned 300 total points
ID: 1221983
Do you want to change the whole image, or parts of an image? Either way the code I gave you has all the functionality you require. Just change the mouseMove() and paintApplet() methods to draw a new image, rather than red ovals.

As for linking to URLs, this is easy. You need a mouseDown() method:

public boolean mouseDown(Event evt, int x, int y)
{   if (area.inside(x, y))
    {   getAppletContext().showDocument(url);
        return true;
    }
    else
        return super.mouseDown(evt, x, y);
}

Where area is a Rectangle of pre-determined coordinates, and url is the URL you want to jump to.

If you build on the logic I gave you in the MouseMotion applet, you can generate an image map, where different parts of an image go to different URLs.

It might help to check out some of the on-line courses available, and buy a book. I've responded to your other question about this.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

885 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