Hi.
I'm playing around with developing a web-based application that needs
to use a java applet in order to implement some advanced functionality
that I don't see as being feasible with pure javascript (it involves
dynamically drawing and editing vector graphics).
My initial design has the workspace area where the vector graphics are
drawn AND the toolbars needed to interact with it both done inside the
applet. The problem with this is that at least one of the toolbar
commands needs to cause the browser to load another web page, which I
don't believe is possible*. It does however seem quite feasible to
have the toolbars implemented in client-side javascript, such that each
button sends a command to the applet. I've tested this and it works
fine under IE6/Java 1.5, and I assume it should work with most
java-enabled browser platforms. In that case there's no problem having
some of the toolbar commands do things such as load another web page.
But are there any known disadvantages to doing it this way? Does
anyone have any experience trying to do this sort of thing? My
toolbars use transparent gifs and some are "toggle buttons", that stay
down once clicked - I'm not sure if there are any issues implementing
these with JavaScript. Obviously it's possible to have some toolbars
done in JavaScript and others be part of the applet, but I'd prefer not
to have to do this if possible.
* There appears to be something called "LiveConnect" that does support
this, but on the one web page I found demonstrating it, it didn't work.
Roedy Green - 17 Feb 2006 05:39 GMT
>The problem with this is that at least one of the toolbar
>commands needs to cause the browser to load another web page, which I
>don't believe is possible*.
there is "Applet.showDocument, but often it does nothing. It is
considered dangerous.
If the web page is under your control and is vanilla HTML 3.1 with
bugs, you can dodge them and render in a JTextPane or JTextEditor.
see http://mindprod.com/jgloss/jtextpane.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 17 Feb 2006 05:41 GMT
> It does however seem quite feasible to
>have the toolbars implemented in client-side javascript, such that each
>button sends a command to the applet
Or vice versa. You can share the work between the JavaScript and the
Java, passing information back and forth. JavaScript is good for
"cheating" and special browser interactions. Java is good for heavy
duty stuff.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
wizofaus@hotmail.com - 19 Feb 2006 22:38 GMT
> > It does however seem quite feasible to
> >have the toolbars implemented in client-side javascript, such that each
[quoted text clipped - 4 lines]
> "cheating" and special browser interactions. Java is good for heavy
> duty stuff.
In the end I got LiveConnect going (via the netscape.javascript
package). It works very nicely under IE 6 and Java 1.5, so I'm hoping
it works under most Java-enabled browser environments.
It's easier to keep the toolbars inside the Java application, as I
can't see any easy way to implement image-buttons in Javascript that
draw as standard buttons as per the environment's windowing system (you
seem to have to provide an image of the whole button, as opposed to
just the icon inside).