Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6078637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:51:22+00:00 2026-05-23T10:51:22+00:00

I am trying to utilize Widget.addHandler() . However, the handler never gets called. Below

  • 0

I am trying to utilize Widget.addHandler(). However, the handler never gets called. Below is my sample code. What do I need to change to fix this?

My Handler Implementation:

public class CustomMouseMoveHandler
  extends GwtEvent.Type<MouseMoveHandler>
  implements MouseMoveHandler
{
  @Override
  public void onMouseMove(MouseMoveEvent event) {
    System.out.println("----> onMouseMove.");
  }
}

My EntryPoint.OnModuleLoad():

ContentPanel cp = new ContentPanel();
cp.setHeaderVisible(false);
cp.setHeight(com.google.gwt.user.client.Window.getClientHeight());

CustomMouseMoveHandler handler = new CustomMouseMoveHandler();
cp.addHandler(handler, handler);

RootPanel.get().add(cp);

/////
Added on 7/1/2011.

The following complete GWT simple code does not work either (with Jason’s hint applied). Please help me out. Thanks

 package tut.client;

 import com.google.gwt.core.client.EntryPoint;
 import com.google.gwt.event.dom.client.MouseMoveEvent;
 import com.google.gwt.event.dom.client.MouseMoveHandler;
 import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.TextArea;

  /**
  * Entry point classes define <code>onModuleLoad()</code>.
  */
    public class GwtHandler implements EntryPoint, MouseMoveHandler {

        /**
         * This is the entry point method.
         */
        public void onModuleLoad() {
           TextArea comp = new TextArea();

           comp.setSize("200px", "200px");
           comp.setText("Testing Text");        

           comp.addHandler(this, MouseMoveEvent.getType());

           RootPanel.get().add(comp);
        }

       @Override
       public void onMouseMove(MouseMoveEvent event) {
           com.google.gwt.user.client.Window.alert("onMouseMove");
       }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:51:23+00:00Added an answer on May 23, 2026 at 10:51 am

    GwtEvent.Type is used to dispatch events based on an event specific and unique object (object equality – == – is used to match event types). Passing your CustomMouseMoveHandler as the Type to addHandler indicates an event type other than that used for MouseMoveEvents (Indeed in this case every CustomMouseMoveHandler would be assigned to a different event Type since each object is different).

    Instead of extending GwtEvent.Type<MouseMoveHandler> in your handler you need to get the event Type from MouseMoveEvent itself (using the static getType() method).

    Don’t extend GwtEvent.Type in your CustomMouseMoveHandler:

    public class CustomMouseMoveHandler
      implements MouseMoveHandler
    {
      ...
    }
    

    And to add the handler:

    cp.addDomHandler(handler, MouseMoveEvent.getType());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to utilize CAS to perform SSO on the same domain name. however
I'm new at code igniter and I'm trying to figure out how to utilize
I am trying to utilize Numpy's fft function, however when I give the function
Hi I'm trying to utilize more java-script, jquery, ajax in my asp code. So
I’m trying to utilize the .NET Framework 3.5 Client Profile in my application but
I'm trying to utilize the power of wordpress to set up a blog on
I am working on a horse racing application and I'm trying to utilize STI
So, im trying to write some code that utilizes Nvidia's CUDA architecture. I noticed
I am trying to utilize Google's AJAX Language API to translate each value in
I'm trying to utilize a class from the Google Toolbox for Mac libraries, for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.