Solved

Highlighting Buttons on MouseOver

Posted on 1997-07-17
1
235 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 50 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Custom Java Application connects to database: Which one of the 20? 4 41
jboss 7.1 start up error 1 63
ejb mdb examples 1 21
Netbeans and org.apache.commons.lang3 issue 3 27
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

733 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