Hi Zhao,
"comlong zhao" <[EMAIL PROTECTED]> wrote on 08/02/2006 01:27:51 AM:
> Thanks a lot for your help. If i have a function named
> "mouseClick1(evt)" and i want to call it, I should use
> "ctx.getInterpreter("mouseClick1(evt)").evaluate("mouseClick1(evt)");"
> ctx is the BridgeContext here.
It would be more like:
ctx.getInterpreter("text/ecmascript").evaluate("mouseClick1(evt)");
> Is it correct? or i should remove the "(evt)".
If you want to pass 'evt' to mouseClick1 you need to include it
but you also need to set it up. So you would need to provide
clientX/Y, screenX/Y, target, currentTarget, etc. Assuming you use
any of those in your function (which is quite common).
If you can use the AWTEventDispatcher (I know it wants a Component
but it doesn't have to be a particularly "real" Component). Really
what it cares about is, when, modifiers, clickCount, x and y. So you
could construct a 'dummy' MouseEvent to pass to the dispatch method.
> Because I do not use any component, I just want to get the
BufferedImage,
> so if i use this way, whether only the GVTtree will be changed? or I
have to
> set a component for it.
The GVTTree will be changed if the script changes anything without any
component.
> I have tried just using the "evaluate" in my code, and got some
errors
> of "AWT-EventQueue-0"
When you get errors including the stack trace is essential if you
expect
any help. I suspect the problem is that
> Thanks a lot
> zhao
>
>
>
> On 7/31/06, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:
> Hi Zhao,
>
> "comlong zhao" <[EMAIL PROTECTED]> wrote on 07/27/2006 03:09:28 PM:
>
> > I think it is possible. Could some kind person give me some
ideas.
> I need
> > to ust a Button to give an event to one SVG file, and then the SVG
> changes on
> > the JCanvas. Like the demo of mines.svg, you could press the SVG
button
> to
> > restart a new game, How to use a JButton to do the same thing?
>
> This is a little unclear to me. Do you want to dispatch an event
> or do you want to call a specific ECMA script function in the document.
>
> If you want to dispatch an event then you will probably want to
> use the batik.gvt.event.AWTEventDispatcher class to dispatch a
> Swing/AWT event into the GVT tree (which will eventually dispatch
> into the DOM tree).
>
> If you want to call an ECMA script function you can get the
> ECMAScript batik.script.Interpretor from the BridgeContext
> (BridgeContext.getInterpreter(String lang) ) and use it's
> 'evaluate(String str)' to call the function. You can also
> use 'bindObject(String name, Object obj)' to bind a Java
> Object into the script environment.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]