Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java Mouse trigger!

Posted on 1997-03-21
1
Medium Priority
?
176 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
[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:
majkl earned 200 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn different types of Android Layout and some basics of an Android App.
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 …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

636 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