Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

With Java Plug-in, document.applets.length returns 0

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
I need to use Java Plug-in, because I use the Swing-package.
When I let my browser, Netscape 4.78, use the Java Plug-in in j2re1.4.1, then JavaScript believe that the appletvector is empty.
I have tested to let JavaScript call methods of an applet that only extends Applet. It worked fine when the Java Plug-in wasn't used (and the appletvector has length 1).
How can I make JavaScript call (swing)applet methods, when my browser is using the Plug-in?
Thanks in advance for your help!
Carina
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
myself, i stick to Java 1 for applets. do you really need swing?
good luck
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are using JRE 1.3.1 or higher. In this Version you can choose the Browser. If you select a Browser, this Browser ignores the default java-classes and uses the new once.
In this case "normal" Applet won't work. If you don not select any Browser, jre 1.3.1 is only used when needed.
If you unselect your Browser in the JRE-Configurator and the close all your Browsers and restart it again, the error will be fixed.
J�rn
 
Carina Svensson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm implementing in Swing, because I heard that this package has a lot of improvements compared to the awt package. Now I have implemented a lot in Swing, but only used the appletviewer.
I could never imagine that using Swing could bring me in to such trouble.
I think I need Netscape 6(or Internet Explorer 4 or higher) to make JavaScript scripting a swingapplet.
Carina
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, now I understand your question:
you have to use this params:
<PARAM NAME = "MAYSCRIPT" VALUE = "true" >
<PARAM NAME="scriptable" VALUE="true">
Then you can call your JApplet from javascript.
Off course you can't use the Applet tag. Use this:

<OBJECT codetype="application/java" NAME="yourName"
WIDTH = 450 HEIGHT = 250 classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">;
<PARAM NAME = NAME VALUE = "yourName" >
<PARAM NAME = CODE VALUE = "yourClass.class" >
<PARAM NAME = ARCHIVE VALUE = "yourArchive.jar" >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3.0">
<PARAM NAME = MAYSCRIPT VALUE = true >
<PARAM NAME="scriptable" VALUE="true">


<!--Netscape--><EMBED NAME="yourName" MAYSCRIPT=true scriptable=true type="application/x-java-applet;version=1.2" java_CODE = "yourClass.class" WIDTH = 350 HEIGHT = 250 pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"></EMBED>;
</OBJECT>
 
Carina Svensson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello J�rn!
I tried to do as you wrote and some other ways, but it still doesn't work(applet array is still empty).
After reading this page:
http://java.sun.com/j2se/1.4/docs/guide/plugin/developer_guide/js_java.html
I believe that the only way to to solve the problem is to install Netscape 6.
Carina
 
Onion rings are vegetable donuts. Taste this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic