Applet's A No Show in IE - Java Applet Development

I'm working on an applet chat client and for some reason the applet won't load up properly in IE. I've checked a number of other browsers, which load the applet fine, but IE refuses. Furthermore, the error message it gives is "class Client.ChatPanel not found" where 'ChatPanel' is the name of the class to be run.
Does anyone have any ideas as to why IE would fail at this and not the other browsers I've tested like Netscape 6, Safari, or Mozilla?
Following is the html that starts the applet:
<applet code="Client.ChatPanel.class" codebase="chatroom/Conference/" height=450 width=500>
<param name="server" VALUE ="xxxxxx">
<param name="room" value = "<? echo $_POST[ 'roomname' ] ?>">
<param name="port" value=1789>
<param name="loginid" value="<?php echo $_SESSION['username']; ?>" >
<param name="password" value="<?php echo $_SESSION['password']; ?>" >
</applet>I've replaced the server with 'xxxxxx' but it normally has the IP address of the host computer. The values for the parameters are pulled from session variables that do work and php is running properly.
Thank you in advance for any help. 

It is because you're using <APPLET>...</APPLET> tags and IE will default to its own VM. This does not recognise the additional classes that Sun JVM has and will not load the applet correctly whereas Mozilla and others will. Use the <OBJECT>...</OBJECT> tags as the applet tags are deprecated.
A tutorial is around here somewhere.
Riz 

I was also facing the same problem
I think the problem is tht you have to prompt the user for plugin donload.
In tht a case go to the bin directory there will be a file HtmlConverter.....
On command line use "HtmlConverter - gui" and browse the HTML file for u r applet.
This will convert u r HTML file which will check for the necessary plugins on the clients machine & will download it if necessary.
I think this should work.
Now if possible pls solve my problem also.
In chat applet I wana display diffenrent messages in dfferent color.
Please help me how to do this.
My email ID is vipinkalra2000#yahoo.com
Expecting a reply from u r side
Vipin

Ideally you want you applet to run in IE. 

Hi
if you wonna display text with different colors you must create JTextPane component.
Define SimpleAttributeSet for every color and define document for JTextPane. Insert new message in this way:
document.insertString(whereToPut, message , color);
Jan
PS: Maybe you can help me. I opend some frames from applet. However when I move from page, the frames disaaper. It look the browser calls frames to be closed. Do you know, what is neccessary to override in application?

There is not much you can do here. That part of the applet framework. You can switch to using Java Web Start and run it as an application instead of an applet.
Or what you can do, is have a "launch page" that opens the page with the applet in a new window using java script ( window.open() ), and then use java script to prevent the user from closing the applet window:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function uhOh() {
//Call the applet to see if its running
if (1 != document.APPLETNAME.appletFunctionThatReturnsState() )
{
event.returnValue = "The Applet will be killed if its running.\n" +
"\nTo exit gracefully:\n" +
     "Chose exit from the menu, then close the window.";
}
// End -->
</SCRIPT>
<!-- WINDOW CLOSE EVENT -->
<BODY onBeforeUnload="uhOh()">
Jan
PS: Maybe you can help me. I opend some frames from
applet. However when I move from page, the frames
disaaper. It look the browser calls frames to be
closed. Do you know, what is neccessary to override in
application?

You might try jarring the entire applet into an archive (rename to .zip and reference in your applet html as "archive")
The applet architecture treats this zip like a separate directory structure branched from the codebase.
You might have to fiddle with paths and class names to get it to work (which might be your actual problem) 

YOU ARE SEVEN YEARS LATE
Please read the thread carefully before posting.
The entire topic became obsolete when Microsoft dropped their 'JVM'.
About seven years ago.
Locking this thread.

Related

Invoking Applet's method from Javascript in Netscape

I am trying to use JavaScript's Applet object to access my applet in the left frame, from a java script embedded in a JSP file in the right frame. I am having trouble accessing the applet's public method in Netscape, but works fine in IE.
I assign the object to a variable as in:
var ap = parent.frames["leftframe"].document.applets[0];
But when I try to call a public method on the applet as in:
ap.attach();
I get an error in the page saying:
Error: Object has no properties.
My applet was embedded in the left frame with <jsp:plugin> tag. So I am not directly using HTML's Applet tag.
Here is the applet code:
<jsp:plugin type="applet" code="MUP11LeftFrame.class"
jreversion="1.3"
iepluginurl="http://java.sun.com/products/plugin/1.3/plugin-install.html"
nspluginurl="http://java.sun.com/products/plugin/1.3/plugin-install.html"
width="90%" height="60%"
name="appletObj">
<jsp:params>
<jsp:param name="MAYSCRIPT" value="true" />
</jsp:params>
<jsp:fallback>
<p>Unable to load java plugin</p>
</jsp:fallback>
</jsp:plugin>
and in the JSP Javascript I access the applet as:
function attach() {
     alert("in jS attach()");
     //parent.leftFrame.appletObj.attach();
     //parent.leftFrame.applets[0].attach()
     parent.frames["leftFrame"].document.applets[0].attach();
}
The above works fine on IE5 ( I tried different ways of accessing the applet object, as commented) but does not work in Netscape. I am using Nestcape 7.01
When I view the source code of the left frame in Netscape, the name of the applet has been infact embedded as:
<embed JAVA_CODE="MUP11LeftFrame.class" TYPE="application/x-java-applet;version=1.3" HEIGHT="60%" NAME="appletObj" WIDTH="90%" MAYSCRIPT="true" PLUGINSPAGE="http://java.sun.com/products/plugin/1.3/plugin-install.html">
<noembed>
<p>Unable to load java plugin</p>
</noembed>
</embed>
So the "NAME" attribute is inserted, then why can't Netscape find the applet object and its public method "attach()"???
Thanks for any help.
Netscape looks for the "scriptable" parameter being set to true.
try:
<jsp:param name="scriptable" value="true" />
I tried inserting the param for "scriptable", but Netscape still gives the error
Error: parent.leftFrame.appletObj has no properties
It is probably not recognizing the applet's public methods????
Thanks for the reply, though 
Can the next examples:
1.
<script>
parent.frames.leftFrame.document.applets["appletObj"].attach();
</script>
2.
And add id="appletObj" attribute
3. Use <applet> tag instead of <embed>
<applet...>
</applet>
Note: It is normal that the label <embed> is used in conjunction with the label <object> in Netscape. 
Hi,
I dont think Netscape will recognise the Applet's Method. I faced the same problem in another project but got out of it thru some work arounds.
Thanks and regards,
Pazhanikanthan. P
pazhanikanthan#yahoo.com 
I agree, I think I read in several places that Netscape has a bug with regards to Applet method calling, but I was hoping that Netscape 7 would have resolved it!
Thanks, and I will assume that this works only with IE. 
Step 1 does not make any difference. Netscape still throws a Javascript error saying that object has no properties
Step 2 did not make a difference
Step 3 is not applicable since I am using the <jsp:plugin> tag which automatically gets converted into an embed tag in Netscape!
Thanks for your replies, I don't think Netscape allows Applet method calling and hence I will just surrender trying to get it work on Netscape!
Can the next examples:
1.
<script>
parent.frames.leftFrame.document.applets["appletObj"].a
tach();
</script>
2.
And add id="appletObj" attribute
3. Use <applet> tag instead of <embed>
<applet...>
</applet>
Note: It is normal that the label <embed> is used in
conjunction with the label <object> in Netscape. 
I am using 1.4.2beta with NN7.02 and don't seem to have any problem JavaScript<-->Java communications.
;o)
V.V. 
BTW, I'm using a simple <APPLET> tag instead of the <OBJECT> (for IE which doesn't work) or <EMBED> for (NN).
;o)
V.V. 
But the problem is that I am using Java Swing in the applet and hence neeed to use the JAVA plugin tag (<jsp:plugin>) to eliminate the long downloading of Swing classes. I guess the plug in is what is not working in Netscape. I found that the simple <APPLET> tag DOES work in Netscape, but that is not an option for me, I need to use the plug in tag for the Swing to work!
Is there a way to still use Swing in applet but not have to download that huge Swing classes/jar??? Then I can revert to using the <APPLET> tag and then all will work fine in both IE and Netscape! Do you know of any gotchas with using the <APPLET> tag for a 2 way communication between Applets and Javascript for IE and Netscape??
Thanks so much for your reply.
BTW, I'm using a simple <APPLET> tag instead of the
<OBJECT> (for IE which doesn't work) or <EMBED> for
(NN).
;o)
V.V.
Do you know of any gotchas with using the <APPLET> tag The only gotchas is that with the use of the <APPLET> tag, you cannot force the download of any JRE -- it will use whatever is on the system. In my case, the applet will only work with JRE 1.4 or above, so I code my applet to look for the JRE version number and if it is anything less, I pop open an information dialog and quit.
See for your self at the link shown below:
http://www.aokabc.com
;o)
V.V. 
Does this sound like a sane solution... Since I need the Swing features and do not want the Applet to download ALL the Swing classes each time, can I have the Java Plug-in installed on the client's browser, but continue using the <APPLET> tag in the JSP and not the <jsp:plugin> tag, so that the APPLET-to-JavaScript & JavaScript-to-APPLET works in both IE and Netscape! That way I am not bothered by the fact that Netscape does not respond to the <jsp:plugin> tag for calling the applet's methods!
Does this sound doable?
Please advice.
Thanks 
It shoud.... try it!
;o)
V.V. 
Hi,
You can try out something like this. I did this as a work around.
Use regular JSP Plug in Tag to load your Plug in.
Run a Thread in an infinite loop inside the Applet after it gets initialised. The Thread will be polling for a Hidden element in the form.
Now I believe u will wait for the User to perform a Screen Action like clicking a Button, etc. At this point of time toggle the hidden element and then when your Thread realises that the Hidden element has been toggled, just stop the Thread and call the respective method which you wanted to call.
This worked for Netscape Browser. For IE, use the traditional methods as usual.
Hope this helps you.
Thanks and regards,
Pazhanikanthan. P

Applet issue with JRE6 Update 10 & 11

Hi, When I call applet method from JavaScript onload function it throws "null" error. The same code works well in all the prior version of JRE6 Update 10.
HTML:
<object name=TestApplet id=TestApplet
            CODETYPE="application/java"
            classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
            codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0_16-windows-i586.cab"
            height="1" width="1" >
      <PARAM NAME="ARCHIVE" VALUE="/Context/resources/applet/Test.jar" />
      <PARAM name="CODE" value="TestApplet" />
      <PARAM NAME="TYPE" VALUE="application/x-java-applet" />
      <strong>
        This browser does not have a Java Plug-in.
        <br />
        <a href="http://java.sun.com/products/plugin/downloads/index.html">
          Get the latest Java Plug-in here.
        </a>
      </strong>
</object>JavaScript:
function onPageLoad() {
var TestApplet = document.getElementById("TestApplet");
TestApplet.callMethod(); // during the call I am getting null error, seems the applet is not loaded.
} 
Folks, I am awaiting your response. 
With the new JRE in 6u10, changes in JavaScript handling were made. One of them may be what you're seeing. Search this change documentation for "javascript" and review each occurrence.
http://java.sun.com/javase/6/webnotes/6u10.html 
I am stuck like you.
did you find a solution to call the applet method...?
Thanks for your help! 
A couple of notes/questions.
- Where does that object element declare the SCRIPTABLE attribute? I am not as familiar with OBJECT elements but I thought they needed to declare that when being called by JS.
- Why use the object form of the applet tag at all? Sun has not supported that for some time, and is now recommending to use the [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html] and the plain old applet element.
- Real's HowTo has a demo under Javascript | Interaction with Java | Call a Java method from Javascript. That page (test page here) works as advertised for me here, using update 1.6.0_10. Does it work for you? 
Here is what I currently do for my applet (it will show you for the scriptable attribut in OBJECT tag):
**********************
<!--[if !IE]>-->
<object id="jcp" classid="java:javlan.class" width="600" height="400"
type="application/x-java-applet" archive="./javlan.jar">
<!--<![endif]-->
<object id="jcp" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="600" height="400">
     <param name="code" value="javlan">
     <param name="archive" value="./javlan.jar">
     <param name="type" value="application/x-java-applet;version=1.3">
     <param name="scriptable" value="true">
</object>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
***********************
Currently, I have the java update 1.6.0_10, FF3 and IE7.
With FF2, everything works well.
But with IE7, here is the thing. The browser is able to load the applet and launchs it. But when my javscript tries to call a method of the applet, the method doesn't exist. I mean, I am able to get the applet object but my function doesn't exist. I tried everything but it doesn't work.
And for your test page, it is with APPLET tag so it doesn't work with IE. 
>
Here is what I currently do for my applet (it will show you for the scriptable attribut in OBJECT tag):>Well there you go, this is the first time I have ever seen a nested OBJECT/OBJECT element.
It is possible the inner element is the only one that is scriptable.
>
And for your test page, it is with APPLET tag so it doesn't work with IE.>Huhh?! When you say "it doesn't work with IE", what do you mean? Is it just lazy? Maybe you should try flogging it, or offering it inducements (the carrot or the stick).
Here, using IE 7.0.5730.13 and Java 1.6, when I activate the 'Call Java' button I get a JS pop-up which gives my screen size.
Edited by: AndrewThompson64 on Jan 6, 2009 12:14 PM 
You're kidding me when you say that it works for you....? :)
I check the code of the test page and they use the APPLET tag, so it should not work.
And with my IE7 and java update 1.6, it doesn't work. IE is not able to load the applet.
How can it work on your side with a APPLET tag....? 
And for my OBJECT / OBJECT object, you can check out this link ;)
[http://depth-first.com/articles/2008/03/10/demystifying-java-applets-part-2-dry-deployment-with-the-javay-method|http://depth-first.com/articles/2008/03/10/demystifying-java-applets-part-2-dry-deployment-with-the-javay-method]
Edited by: MathieuDUVAL91 on Jan 5, 2009 5:36 PM 
>
You're kidding me when you say that it works for you....? :)>I realize you were joking in that statement, but for the record..
Yes it works perfectly for me in IE 7 running 1.6.0_10 (I thought it worth checking and adding the exact Java version, as opposed to the original '1.6' I stated).
>
I check the code of the test page and they use the APPLET tag, so it should not work.
And with my IE7 and java update 1.6, it doesn't work. IE is not able to load the applet.>What is the exact error message you are getting? Do you know how to find/open the console (that is not intended as sarcasm - the console seems to be harder and harder to get access to, in modern browser variants)?
>
How can it work on your side with a APPLET tag....?>I think it would be more productive to find out why it fails for you.
-----------------------------
Re: [http://depth-first.com/articles/2008/03/10/demystifying-java-applets-part-2-dry-deployment-with-the-javay-method|http://depth-first.com/articles/2008/03/10/demystifying-java-applets-part-2-dry-deployment-with-the-javay-method].
OK - now I've seen it, but..
Did you notice the last comment on that page, by the author, states..
"It also turns out there's a gnarly bug with the JDK 1.6 plugin on IE 7 and the jActivating library that essentially makes the exact method described here unusable. ..."
-----------------------------
I have to admit. Ultimately I am more interested in figuring why the applet element is failing. Sun's latest deployment advice for applets is to use JavaScript to check the right minimum VM is available, then use JS to +write an applet element to load the applet.+
If this technique fails in IE7, it will cause problems for a lot of applets. 
Me, I don't have any error. I don't see the java console so I don't understand. In the java setup, you can put the option to open automaticaly the console when running java stuff.
I am really mad because the code I put in this topic works really good. In both FF and IE7, my applet is launched correctly. But next, when I want to call a specific function on my applet from my javascript (to check if my applet is done), it doesn't work with IE.
With FF, I have the following prints:
*************
document.jcp: '[object HTMLObjectElement]'
typeof document.jcp.isAppletDone: 'function'
value of document.jcp.isAppletDone: 'function isAppletDone() {
[native code]
}'
typeof of getCodeBase : 'function'
*************
And with IE, I have the following:
*************
document.jcp: 'javlan[panel0,0,0,600x400,layout=java.awt.FlowLayout]'
typeof document.jcp.isAppletDone: 'unknown'
typeof of getCodeBase : 'unknown'
*************
Everything works but the interaction between javascript and my applet is broken after the applet is launched.
It is why I try to go back with APPLET tag now. But I am not able to launch the applet with APPLET tag.
If I could just understand why my javascript is not able to cal my applet.... 
>
I am really mad because the code I put in this topic works really good. In both FF and IE7, my applet is launched correctly. But next, when I want to call a specific function on my applet from my javascript (to check if my applet is done), it doesn't work with IE.>That might be fixed for IE using a HTA.
>
It is why I try to go back with APPLET tag now. But I am not able to launch the applet with APPLET tag.>Why not? 
Thanks for the HTA, I didn't know about it but it doesn't work.
For the APPLET tag, I don't wanna come back to this because it is depracted now so you don't know when browser will remove it...
To be more specific about my applet, here is the code of my applet:
***********
public class javlan extends Applet
{
public void init()
{.......
}
public boolean isAppletDone()
{.......
}
public String getStatusMssg()
{......
}
}
***********
IE is able to call the init() function automaticaly when it launch my applet but it doesn't know my function isAppletDone()... 
>
For the APPLET tag, I don't wanna come back to this because it is depracted now so you don't know when browser will remove it...>'Deprecated' means a different thing for a Java class, than it does for HTML. An applet element is fully supported in HTML 3.2, and browsers are not about to drop support for HTML 3.2, no more than they would drop support for loading text files.
I will not be expending further time on this matter unless you change the code to use the applet element. 
thanks but what does really mean depracted in HTML?
I tried again with the APPLET tag. If I use your .hta extension, it works fine but with an .html extension, it doesn't work.
Here is the code of the applet:
*****************
<APPLET
CODE="javlan"
CODEBASE="./"
ARCHIVE="./javlan.jar"
HEIGHT="400"
WIDTH="600"
NAME="jcp"
MAYSCRIPT
>
     <param name="scriptable" value="true" />
</APPLET>
*****************
And when it works with the .hta, if I try to call my function, it fails....
Thanks for your help on this
Edited by: MathieuDUVAL91 on Jan 6, 2009 4:53 PM

scriptable applet???

I need to call a function inside my applet from javascript in my page. The only information I can find about doing this says that I need to set the scriptable attribute to true. I am testing on Firefox on Linux, but I need this to work on IE 6 and 7 and Firefox in Windows. The following applet tag works on Firefox/Linux, but I have not tested it on Windows. Everything I have read recommends using the object tag in IE, and the applet tag is technically deprecated.<applet code="package/applet" width= "600" height= "760"
     archive="myApplet.jar"
     MAYSCRIPT>
          <param name="type" value="application/x-java-applet;version=1.5" />
          <param name="pluginspage" value="http://java.sun.com/j2se/1.5.0/download.html" />
          <param name="scriptable" value="true" />
</applet>I also don't know if the pluginspage parameter will work in an applet tag.
Apparently, IE recognizes the object tag and the comment tag and Firefox does not. Also, Firefox recognizes the embed tag and IE does not. I have verified both of these, but unfortunately I also discovered that the embed tag does not support scriptable, either as an attribute or as an param tag inside the embed. So I tried pasting the above applet tag inside my comment tag, thinking that if the embed loads the applet then the applet tag should work in there as well. However, with the exact same applet tag inside the comment tag, the applet loads but scriptable does not work. It seems like scriptable only works outside of an object and comment tag, even though Firefox is not supposed to notice those tags.
Had anyone ever seen a scriptable applet work on both IE and Firefox? If so, what tags were used to load the applet in the page? 
Had anyone ever seen a scriptable applet work on both IE and Firefox? If so, what tags were used to load the applet in the page?The applet tag with MAYSCRIPT has always worked for me on both IE and Firefox.
Example.
<applet width="100%" height="400" name="myapplet" CODE="[snipped]" ARCHIVE="[snipped]" MAYSCRIPT>
<param name="sessid" value="4EBAB144">
</applet>Elsewhere
<script type="text/javascript">
function fireAppletUpdate(){
  document.myapplet.doUpdate();
}
</script> 
sawatdee wrote:
Everything I have read recommends using the object tag in IE, and the applet tag is technically deprecated.Just on this particular issue. This has been this way for a long time, however the applet tag works. I think the disadvantage is that the applet tag is less likely in case of Java not existing to do the right thing aka direct to install.
However, I have yet to run into a situation where this was an issue. Mainly because the applet users I have all encountered are not general web users but all users of a specific application within a specific company. 
I've read that mayscript is only for applet-to-page communication, but scriptable must be used for page-to-applet communication. Even with mayscript in my embed tag, if I call document.myApplet.someFunction () I get a javascript error from Firebug that says, "document.myApplet.someFunction is not a function" and my applet does not receive the function call. 
sawatdee wrote:
I've read that mayscript is only for applet-to-page communication, but scriptable must be used for page-to-applet communication. Even with mayscript in my embed tag, if I call document.myApplet.someFunction () I get a javascript error from Firebug that says, "document.myApplet.someFunction is not a function" and my applet does not receive the function call.Okay well whatever you heard I don't know.
What I do know is that using the example above I have an applet that calls JavaScript and JavaScript calls the applet (both ways) and it works in IE and Firefox on Windows and Firefox on OS X.
So... I don't know what else to tell you really. 
The applet tag and MAYSCRIPT combo seems to work in firefox and explorer on windows machines but I can't get it to work in Linux. Any idea how to fix this?
I tried using the <object> and <embed> tags also but couldn't get it to work. 
Have you got this working? I'm fighting a similar battle and can get everything working in IE but FireFox gives me my dreaded "... is not a function" error message.
For any lurkers: I want a Java applet that I can call methods from JavaScript and I also want to be able to call JavaScript functions from Java. This works today... but only under IE (32bit Win/XP & 32bit Win/Vista). I'd love to have a single bit of HTML to do this but am at the point where I'll do browser detection in PHP and serve separate pages if that's the only road open.
I think there are a few axis to this problem:
1) Browser & Version: IE, Firefox, Safari, Opera etc
2) OS: Windows, Linux, Mac
3) Java plugin vendor & version
4) How do you build the applet/object/embed tag? Static HTML in the body or document.write() from JS?
I'd appreciate any links to solved examples for the above permutations.
Thanks,
J.J.

Neither progressbar nor boxmessage works

I have added these two parameters to an applet but they have made no difference. I see neither progress bar or the text I want to show.
I am wondering if anyone could shed some light on this?
Thanks in advance. 
Show your code.
Edited by: toddburch on May 4, 2009 9:22 AM 
Here is my code:
<applet code="myapp" alt="Test " width="100%" height="100%" archive="myapp.jar" title="test">
<PARAM NAME="TYPE" VALUE="integrated">
<param name="progressbar" value="true">
<param name="boxmessage" value="Please wait...">
</applet> 
Now show your java code. 
I do not have the code with me now, but I can access it later.
If you do not mind, could you tell me how this is related to the code of the applet? I thought this would work with any applet regardless of its content.The specs does not mention any requirement of the applet content 
For convenience, I copied the specs of the attributes as following:
Special Attributes
image
The image attribute allows you to replace the default coffee cup logo with a custom graphic. The format with the standard APPLET element is:
<APPLET ...>
<PARAM name="image" value="my_image.gif">
</APPLET>
See Using OBJECT, EMBED and APPLET Tags in Java Plug-in for how this would be mapped to the OBJECT or the EMBED tags.
If a custom graphic is specified, it should be the same size as the area of the applet window. If these sizes do not match, the graphic will be placed in the upper left corner of the area specified for applet. If it is larger than the applet window, part of it will get chopped off. If it is smaller than the applet window, gray, or whatever color is specified for boxbgcolor, will appear around it.
The image can be either a GIF or JPEG, and it should reside in the same directory where other resources for the applet reside; i.e., if the applet uses the codebase attribute, then this image should be in the codebase directory.
Note: The image file should not be in a packaged jar file with other applet resources, since the image needs to be displayed while downloading resources.
The status bar of the browser will display "Loading Java Applet ..." when the mouse is pointed at the applet window.
progressbar
With the progressbar attribute you can request display of a progress bar instead of the default graphic. The progress bar will horizontally fill the applet window up to 6 pixels to the right and left. The text "Loading Java Applet ..." will appear above the progress bar and be center-aligned with it. By default the progress bar is purple. The format for turning on the progress bar with the standard APPLET element is:
<APPLET ...>
<PARAM name="progressbar" value="true">
</APPLET>
The status bar of the browser will display "Loading Java Applet ..." when the mouse is pointed at the applet window.
boxmessage
With the boxmessage attribute you can customize the text that is displayed. If you use this attribute, the text will be used with the progress bar and with the status bar of the browser. The format for using this with the standard APPLET element is:
<APPLET ...>
<PARAM name="boxmessage" value="<your custom message goes here>">
</APPLET> 
I asked for the Java code because I was not aware this applet you are calling had a defined API.
Now that you have provided this new information, it appears you are calling the applet with the correct params.
It seems as if you need to go the author of the applet to ask the question "why does it not work when I follow your directions?" Without source code, I cannot help.
Todd 
Could anyone offer a pointer to a Web page having an applet with progressbar or messagebox working? 
>
Here is my code:
<applet code="myapp" alt="Test " width="100%" height="100%" ...>Usage of percentage values is not officially supported, and never worked in Opera at all. The value should be an integer, implying pixels.
Try it without using percentage values. If that fails, try posting the entire HTML (which removes % values), not just the applet element, and I might play with it here (I agree this has nothing to do with the applet code - it is all about the HTML). 
To avoid confusion by my original complicated HTML page, I created a simple page as following just for the sake of testing this. The applet shows up, but not a blink of progressbar or boxmessage.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
</head>
<body>
<applet code="NewJApplet" archive="test.jar" width="600" height="600" alt="test" title="test">
<param name="progressbar" value="true">
<param name="boxmessage" value="Please wait...">
</applet>
</body>
</html> 
OK. This turned out to be a little more complex than I expected. From [Special Applet Attributes (1.6): boxmessage|http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/special_attributes.html#boxmessage]
"With the boxmessage attribute you can customize the text displayed in the status bar of the browser. *This attribute will be in effect when image attribute is used.* ..."
That bold part (emphasis mine) seems quite odd. That a status bar message should be dependent upon specifying a custom graphic for the applet area. I cannot see the logic. From [Special Applet Attributes (1.6): image|http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/special_attributes.html#image]
"The image attribute allows you to replace the default animation with a custom graphic. ..."
Now, note that the 1.6 document has no mention of the progressbar (which is also quite odd), but going back to the same document for 1.4.2, [Special Applet Attributes (1.4.2): progressbar |http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/special_attributes.html#progressbar]
"With the progressbar attribute you can request display of a progress bar instead of the default graphic. ..."
I am guessing that the image and progressbar attributes are mutually exclusive, we can have one or the other.
Adding further to the confusion is that the lack of image is suppressing the boxmessage.
Try one (boxmessage+image) or the other (progressbar) separately.
Note also that neither might not work as expected if the applet is very small. Perhaps the JRE has a pause before it displays either, in the hope that the applet will load fast enough to make them unnecessary.
Edit 1:
In fact, I am becoming more certain that 'small applet' will cause a problem for the status bar message, which might display briefly then be replaced with "" (a blank status message) once the applet loads - AFAIU.
Edited by: AndrewThompson64 on May 5, 2009 12:48 PM
Edit 2:
And I doubt any of this will work in AppletViewer - make sure you test with a sizable applet, in a browser.
Edited by: AndrewThompson64 on May 5, 2009 12:52 PM 
Thanks a lot for the help.
I created a gigantic applet of 5MB and tried a few configurations, but none works.
I am a bit confused now and intend to give up unless someone shows an applet with these attributes working.
Thanks again! 
So, the burden of proof is on us to show you how a properly coded PARAM and a properly set up applet to implement the param works for your situation, without you providing the source for the applet?
Oh well, you win. 
Though I still do not understand why the Java code is related to this problem, but I will post the applet code as soon as I have access to it later.
It is essentially an applet with a label control which text = "test". In other words, it does nothign but showing the word "test". It was created by Netbeans 6.5. To make the applet large enough to requrie noticeable download time so these features will show up supposedly, I throw a 5MB image file in the jar file but the image is not used all. The applet works fine, but the plug-in shows neither progressbar nor boxmessage. 
If the Java code does not properly parse and implement the PARAM values, then obviously they will not work. That's why I'm asking for the code.

How can an applet return some value ?

I want to know how can an applet return some value when embedded any page that includes HTML ? 
What do you want to do with this value? Give an example..
You can pass a value over http, for example to a cgi script or servlet, but I don't know if that can help you out. There is also a way for one applet to communicate with another applet on the same html page. 
Just as an example,
1. Declare a String str in the applet (App.class) as a public variable.
2. Include this applet in the HTML / JSP.
<applet name="app" code="App.class" height="400" width="400" mayscript>
3.You set the value of str in the init() or start() methods.
4.Click a button in the HTML page to execute a javascript function testApplet().
5.You can get the value of str by,
var name = document.app.str;
Hope this helps.
Sudha 
I have written a small Java program over a year ago to reformat HTML document that contains JavaScript and later on made some mod to reformat Java source file (not perfected yet). Here is a link:
http://home.attbi.com/~aokabc/jsFormat/jsFormat.htm
and here is the source file:
http://home.attbi.com/~aokabc/jsFormat/jsFormat.java
The reason I am posting this is I think it will serve as a good example to explore how you can do JavaScript-->Java-->JavaScript. The example will work wil IE5+ and NN4+ (without plugin by using the browser's native JVM) and NN6+ (using plugin since NN6 has no native JVM). The communication is done via netscape.javascript.JSObject which you can find in the installed Netscape directory (this iwill work with both IE and NN) using what is knowned as LiveConnect.
V.V.
PS: Note that JSObject does not work with the swing class.
Sorry, first link was mistyped and should be:
http://home.attbi.com/~aokabc/jsFormat/Lint1.htm
V.V.

Categories

Resources