Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

Combining applets and javascript

Thread view: 
wizofaus@hotmail.com - 17 Feb 2006 01:55 GMT
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).


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.