Solved

MouseOver applet

Posted on 1997-06-23
1
410 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 100 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

770 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