Solved

Java Mouse trigger!

Posted on 1997-03-21
1
167 Views
Last Modified: 2006-11-17
I would like to write a applet including a textfield and a mouse.  When move the mouse pointer over the textfield, the text in the color of the text in the textfield will be changed to another color.  Can anyone tell me what is the algorithm?
0
Comment
Question by:benson031397
1 Comment
 
LVL 2

Accepted Solution

by:
majkl earned 100 total points
ID: 1219108
First you must extend TextField, and there watch for actions.
I have tried this code, but it doesn't work. It seems, tha Textfield cannot react to mouse move.
Other components can.

Here is example :
class MY extends TextField
{
   public boolean mouseMove(java.awt.Event evt, int x, int y)  

    {
         System.out.println("moved");
       return true;
    }
   
   public boolean handleEvvent(Event event)
     {

        if (event.id == Event.MOUSE_MOVE)
          {
               System.out.println("moved");
          }
        return true;  
     }

In this way you can generraly do it for all components in the same way.
I was also surprisedm that Texfield doesn't work, but I think that was also one discusion in NewsGroups.
Hope you will help me with scores although it does'nt work

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bunnyEars challenge 6 64
pairstar challenge 2 41
word0 challenge 3 58
groovy example issue 10 66
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.

706 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

20 Experts available now in Live!

Get 1:1 Help Now