I came up with something that works by making 'javaMethod' static.  I
can call it like so that way.

@com.foo.bar.MyClass::javaMethod

This feels a bit like I'm jumping through a hackish hoop simply
because I don't know the syntax that is likely available to me for
doing the job.  Any help would be greatly appreciated.

On Nov 19, 5:07 pm, Bryan <bwn...@gmail.com> wrote:
> I'm following the example seen here for 'calling Java methods from
> JSNI' and it works great.
>
> http://googlewebtoolkit.blogspot.com/2008/07/getting-to-really-know-g...
>
> I'm trying to do something slightly different though.  Here's what it
> is.
>
> package com.foo.bar;
>
> public class MyClass {
>
>         private void javaMethod(String s) {
>                 Window.alert("called the java method with String " + s);
>         }
>
>         private native String nativeMethod() /*-{
>
>                 var myFunc = function() {
>                         // trying to call the 'javaMethod' method from here 
> and the
> notation
>                         // at the link above does not work
>                         //
>                         // notation that is not working for me
>                         // 
> th...@com.foo.bar.myclass::javaMethod(Ljava/lang/String;)
> ('coming from nativeMethod.myFunc');
>                 }
>
>     }-*/;
>
> }
>
> It doesn't surprise me that what I'm trying doesn't work, I'm assuming
> the 'this' I'm trying to use is in the wrong scope.  Anyone have any
> suggestions for how I can get to that java method from within a native
> method that defines a function?

--

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


Reply via email to