Using an example :

Say you have this code in your normal GWT/Java code, in a class
"FunConfigurator" :

public void onJCrop(int x, int y, int x2, int y2)
{
      Window.alert("in gwt: (" + x + "," + y + ")");
}

Now to call this from JSNI do the following (only the fc.@ line is of
any importance) :

private static native void activateJCrop(FunConfigurator fc)
   /*-{
         $wnd.jQuery(function()
         {
            $wnd.jQuery('#cropbox').Jcrop({
               onSelect: showCoords
            });
         });

         function showCoords(c)
           {
               // variables can be accessed here as
               // c.x, c.y, c.x2, c.y2, c.w, c.h
              var s = "hallo"
 
f...@be.fks.elka.clientgui.client.configurator.fun.FunConfigurator::onJCrop(IIII)
(c.x, c.y, c.x2, c.y2);
           };
   }-*/;


In detail :
f...@be.fks.elka.clientgui.client.configurator.fun.FunConfigurator::onJCrop(IIII)
(c.x, c.y, c.x2, c.y2);
fc = The class that contains the java method you want to call. This is
passed as a parameter to the JSNI method
@be.fks.elka.clientgui.client.configurator.fun.FunConfigurator = The
fully qualified classname (packagename + funconfigurator)
onJCrop : The name of the Java method to call
(IIII) : The params are 4 integers (see below for other available
types)
((c.x, c.y, c.x2, c.y2) : The actual parameters to pas from JS to Java


Note that the IIII means : 4 integers.
These are the possible types :
Z       boolean
B       byte
C       char
S       short
I       int
J       long
F       float
D       double
L fully-qualified-class ;       fully-qualified-class
[ type  type[]
( arg-types ) ret-type  method type


Hope this helps...

On Dec 12, 3:12 am, Alex Luya <[email protected]> wrote:
> Like this:
> Class A{
>         private void javaMethod(int a,int b){}
>
>         private native void init()/*-{
>                 function OnMouseMove(e) {
>                         //following code doesn't work
>
> this.@p::javaMethod(Ljava/lang/Integer;Ljava/lang/Integer;)(intVal,_intVal) ;
>                 }
>         }}
>
> --------------------------------------------------------------------------- 
> -------------------------------
>     As described above,how to solve this problem?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to