Solved

Java Mouse trigger!

Posted on 1997-03-21
1
172 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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 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 learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

838 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