?
Solved

Highlighting Buttons on MouseOver

Posted on 1997-07-17
1
Medium Priority
?
244 Views
Last Modified: 2012-08-14
I would like to know how I can highlight a button when you place the mouse over it (similar to how Netscape Communicator or Internet Explorer does it).  Some source code would be appreciated.  Thanks.
0
Comment
Question by:Yoda
[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
1 Comment
 
LVL 2

Accepted Solution

by:
mgk earned 200 total points
ID: 1223255
That's pretty easy - use the mouse events to trigger the use of a new image. I've left some stuff out of this applet but you should get the hang of it from this;

Boolean  on;
Image    onimage,offimage;

public void init() {
onimage=getImage(getCodeBase(),"onimage.gif");
offimage=getImage(getCodeBase(),"offimage.gif");
}

public synchronized void paint(Graphics g) {
   if (on) g.drawImage ( onimage, 0, 0, this );
   if (!on) g.drawImage ( offimage, 0, 0, this );
}
 
public boolean mouseEnter(Event e, int x, int y)  {
   on=true;
   repaint();
   return true;
}  
      
public boolean mouseExit(Event e, int x, int y)  {
   on=false;
   repaint();
   return true;
}  

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

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…
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…
This video teaches viewers about errors in exception handling.
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
Course of the Month8 days, 6 hours left to enroll

764 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