Solved

MouseOver applet

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now