Solved

simulating the JavaScript mouse over function in Java

Posted on 1997-05-17
2
518 Views
Last Modified: 2011-10-03
I'm trying to write a standalone java application (not an applet).  I'm
using Symantec's Visual Cafe Pro (if that's important).

One of the functions I need to implement is the Java Script mouse over.
I have a single large gif.  Within the gif are 4 areas that, when the
mouse moves over, I'd like to replace with a highlight image.

Example: picture a large gif of an airplane.  As I move the mouse over
the windows, I'd like to have people's faces pop-up.

My questions are:

1) is it better to split the base image into smaller images (ie the
plane and each separate window) or to have one big initial gif?

2) is there a mouse over function or do I have to trap mouse position?

3) is there a way to support Java Script directly in a standalone java
application?

If you don't mind, could you please CC me via e-mail on any response.
Thanks in advance.

PS: I'm never too proud to accept example source code ;)

--
Ken Kranz                        WEB Systems Administrator
mailto:http://kkranz@ebbtide.com      V: 516.582.5270 x333
0
Comment
Question by:kkranz
[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
2 Comments
 
LVL 6

Accepted Solution

by:
jpk041897 earned 50 total points
ID: 1220542
>1) is it better to split the base image into smaller images (ie the
>plane and each separate window) or to have one big initial gif?

No, keep the image straight.

>2) is there a mouse over function or do I have to trap mouse >position?

Yes, its the handleEvent() method. Its general form is:

/*File Event01.txt
This is Listing 19-12 from Using Java, Special Edition
by Joseph Weber, et al.
*/
public boolean handleEvent(Event evt) {
  switch (evt.id) {
    case Event.MOUSE_ENTER: return mouseEnter(evt, evt.x, evt.y);
    case Event.MOUSE_EXIT: return mouseExit(evt, evt.x, evt.y);
    case Event.MOUSE_MOVE: return mouseMove(evt, evt.x, evt.y);
    case Event.MOUSE_DOWN: return mouseDown(evt, evt.x, evt.y);
    case Event.MOUSE_DRAG: return mouseDrag(evt, evt.x, evt.y);
    case Event.MOUSE_UP: return mouseUp(evt, evt.x, evt.y);
    case Event.KEY_PRESS:
    case Event.KEY_ACTION: return keyDown(evt, evt.key);
    case Event.KEY_RELEASE:
    case Event.KEY_ACTION_RELEASE: return keyUp(evt, evt.key);

    case Event.ACTION_EVENT: return action(evt, evt.arg);
    case Event.GOT_FOCUS: return gotFocus(evt, evt.arg);
    case Event.LOST_FOCUS: return lostFocus(evt, evt.arg);
  } //end switch
  return false;
}

>3) is there a way to support Java Script directly in a standalone >java
application?

No, Javascript is completley browser dependant.

>PS: I'm never too proud to accept example source code ;)

Although I don't know of any examples that specificaly adrees your request,
the theory and samples in the first three lessons at:

http://www.phrantic.com/scoop/Java000.htm


should be enough to get you going. You might also want to look at:

http://www.inf.uni-hohenheim.de/top/java/tutorial/ui/drawing/usingImages.htm
l

for information (and samples) regarding images.

0
 

Author Comment

by:kkranz
ID: 1220543
The MOUSE_ENTER & MOUSE_EXIT were the keys that I was looking for.  I ended up overlaying an image viewer on each hot area.  Using MOUSE_ENTER & MOUSE_EXIT I can make the java script hot cursor look alike.  In fact, by using the image viewer I can now circulate between various images as the cursor goes over the same area.

Good answer though.  Thanks so much for the help.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

738 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