Java applets can call JavaScript by means of the exception event mechanism.
You can also embed fragments of JavaScript inside Java applets although there are some limitations to what you can accomplish with this.
For this to work, Java and JavaScript both have to be enabled and working. This may require some preference setting. It also only works in Netscape for the time being.
Things are slightly different with Netscape 6.0. No longer do you get a Java VM packed and embedded in the browser. Instead, it depends on the one you have installed in the OS. If you don't have one installed or if Netscape can't find it, then Java won't work. There's not a great deal of help provided on this aspect of the installation.
Once you do have it installed and working, the Java connectivity should behave as it did before.
Writing a Java applet to handle a rollover effect is not such a challenging task as you might think, and is one of the things that can be accomplished quite early in your career as a Java programmer. Java is capable of much more than that, but if you are going to tackle a large Java-driven project, you need to think it through and plan it much more carefully.
Scripting in general seems to be amenable to being developed on the fly and with a minimum of forethought and planning and it's good for putting something together really quickly. Of course getting good at it takes some time. Getting good at Java will probably take longer still. There's a lot more to consider with Java (considerably more than with JavaScript) and the process of creation and deployment is far more unwieldy than putting JavaScript in web pages.
Your Java code will be far better for having thought the object model through and constructed it carefully. JavaScript lets you get right in there and start manipulating a pretty good object model right away. Of course there are objects already there in Java, but you do need to start building from a lot lower down.
Prev | Home | Next |
.jar | Up | .java |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |