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 7602629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:27:40+00:00 2026-05-30T23:27:40+00:00

I am porting same very handy Canvas and Animation libraries to GWT using the

  • 0

I am porting same very handy Canvas and Animation libraries to GWT using the JSNI feature. Being the first library I am wrapping I could use a little assistance with this particular constructor:

/**
* This is passed as the parameter to onPress, onMouseMove, onMouseUp, onMouseDown, and onClick handlers on
* DisplayObject instances.
* By default, mouse events are disabled for performance reasons. In order to enabled them for a specified stage
* set mouseEventsEnabled to true on your stage instance.
* @class MouseEvent
* @constructor
* @param {String} type The event type.
* @param {Number} stageX The mouseX position relative to the stage.
* @param {Number} stageY The mouseY position relative to the stage.
* @param {DisplayObject} target The display object this event relates to.
* @param {MouseEvent} nativeEvent The native DOM event related to this mouse event.
**/
var MouseEvent = function(type, stageX, stageY, target, nativeEvent) {
  this.initialize(type, stageX, stageY, target, nativeEvent);
}
var p = MouseEvent.prototype;

You can view the entire class here: http://easeljs.com/docs/MouseEvent.js.html

My question is, how do I go about passing the event from GWT and successfully feed it to the JSNI constructor for this class?

FYI: I have forked Timknip’s GWT port of Easeljs (0.2.1) and i’m updating it to include the latest Easel features (0.4.0). https://github.com/timknip/easel-gwt

EDIT: I think the native event would be a function you have written in Java, correct? Say you want to add a ONMOUSEUP event when you click the canvas somewhere, and the logic is kept in a function you wrote called “onClickSomeButton()”, then you want to pass this method as a parameter in this constructor? I don’t think Java can pass methods as parameters but isn’t there some way to wrap this by extending some abstract GWT class?

  • 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-30T23:27:41+00:00Added an answer on May 30, 2026 at 11:27 pm

    All JavaScript functions are treated as objects, so you can simply pass it as an overlay type (extending JavaScriptObject), or as the underlying type (JavaScriptObject itself).

    When encountering an issue like this, it’s best to treat the handler (JavaScript event handler) – appearing as a function at the JavaScript layer – as an interface, defining one method at the Java layer, and wrapping a JSO underneath.

    Please refer to Google’s docs on overlay types for more on this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm considering porting a very simple text-templating library to scala, mostly as an exercise
I'm currently porting a very nice demo of a modular web interface using OSGi
I have a very strange problem. Using Gmap3, I place the pin on the
I'm porting a program that had a very long loading time which was not
I am posting a very simple form using a method I have used frequently
Designing UIs with QtCreator under Windows, and porting the same .ui file under MacOSX
Unfortunately after very long time i'm re-posting again about the same problem: org.apache.jasper.JasperException: The
I need to have multiple forms in the same webpage, all of them POSTing
Porting an application from C# (1.1 framework) to VB.NET (3.5 framework), and I have
Porting code from 32bit to 64bit. Lots of places with int len = strlen(pstr);

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.