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

  • Home
  • SEARCH
  • 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 8636171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:09:51+00:00 2026-06-12T10:09:51+00:00

I have this code: DOM.setEventListener(row.getElement(), new ClickListener(){ @Override public void onClick(Widget sender) { //

  • 0

I have this code:

DOM.setEventListener(row.getElement(), new ClickListener(){

    @Override
    public void onClick(Widget sender) {
    // TODO Auto-generated method stub

    }});

I think the code is fine and ClickListener extends EventListener, but it gives error saying: The method setEventListener(Element, EventListener) in the type DOM is not applicable for the arguments (Element, new ClickListener(){})

  • 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-06-12T10:09:53+00:00Added an answer on June 12, 2026 at 10:09 am

    The real answer is that you probably don’t. While this is available to attach listeners to events, you may only attach a single listener per element – that listen then gets all dom events that have been configured (see DOM.sinkEvents) – and you are responsible for making sure to detach all listeners before the page unloads, else some browsers will leak memory.

    Instead, strongly consider using a Widget (and subclasses) to manage events. RootPanel, the base widget that others should be added to, will manage detaching all other widgets from the page to prevent memory leaks.

    Additionally, you are able to listen to the events that happen within there based on the kind of event you are after. For example, even on a widget like a Label that doesnt’ normally fire mouseover events, you can still attach handlers and get notification:

    Label label = new Label();
    label.addDomHandler(new MouseOverHandler() {
      @Override
      public void onMouseOver(MouseOverEvent event) {
        // do something
      }
    }, MouseOverEvent.getType());
    RootPanel.get().add(label);
    

    In most cases, you’ll be using existing support methods, like Button to get a click event – there are convinience methods already there for you, thanks to interfaces like HasClickHandlers:

    Button button = new Button();
    button.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        // do something
      }
    });
    panel.add(button);
    

    More on GWT, Widget, and Memory leaks:

    • https://developers.google.com/web-toolkit/articles/dom_events_memory_leaks_and_you
    • http://code.google.com/p/google-web-toolkit/wiki/UnderstandingMemoryLeaks
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code : void Main() { System.Timers.Timer t = new System.Timers.Timer (1000);
I have this code for changing the image of a button: - (void)mouseEntered:(NSEvent *)event
I have this code: con.Open(); cmd = new MySqlCommand(String.Format(SELECT concat(name,'|',lastname) FROM {0} WHERE ID=
I have this code: class LFSeq: # lazy infinite sequence with new elements from
i have this html code. Im using Simple HTML Dom to parse the data
I have this recursive code that transverses the DOM and adds a prefix to
I have this code for logging into Google using Simple DOM Parser with curl.
So I have this code: <!-- New Array for my loop --> <cfset filesArray
I have this JQuery Code, Its in the DOM Ready, on click of .deleteCatFavs
I have this loop code to reduce the DOM calls in my Javascript, and

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.