Solved

Java Mouse trigger!

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

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
how to install java on RHEL image on EC2 4 57
hibernate example using maven 12 81
null output 3 42
login form jsp example 2 50
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

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