confussed about showStatus in java.applet.Applet

Y

yawnmoth

I have a file - HelloWorld.java that uses showStatus - and test.html
(that includes HelloWorld.class as an applet) - and... showStatus
doesn't seem to be working. According to the description on
java.sun.com...

"Requests that the argument string be displayed in the "status window".
Many browsers and applet viewers provide such a window, where the
application can inform users of its current state."

I'm not really sure what this status window they're refering to is, but
I assume it to, in FireFox, be the part that says "Applet HelloWorld
started". Unfortunately, that's not what I want it to say.

Here's HelloWorld.java:

import java.applet.Applet;

public class HelloWorld extends Applet
{
public void start()
{
showStatus("Hello, world!");
}
}

And here's test.html:

<applet width="1" height="1" code="HelloWorld.class">
</applet>

Any ideas?

Also, is there any way to output text other than showStatus or without
using java.awt.Graphics?
 
A

Andrew Thompson

yawnmoth said:
I have a file - HelloWorld.java that uses showStatus - and test.html
(that includes HelloWorld.class as an applet) - and... showStatus
doesn't seem to be working. According to the description on
java.sun.com...

"Requests that the argument string be displayed in the "status window".
Many browsers and applet viewers provide such a window, where the
application can inform users of its current state."

I'm not really sure what this status window they're refering to is, but
I assume it to, in FireFox, be the part that says "Applet HelloWorld
started".

Correct. Noite that Sun's wording there is significant
in the word 'request'. A browser/UA may not even have
a status line (e.g. the UA is in 'full screen' mode, or the
applet is in a pop-up with no window decorations).

for that reason - only information that the end user can
do without, should be dsiplayed there. The only thing
I have used showStatus() for, is to show the applet version..
...Unfortunately, that's not what I want it to say.

I suspect the problem is that your message is being written,
*then* the browser's own 'applet loaded' message
overwrites it. Try showing your message after the user
clicks a button.
Also, is there any way to output text other than showStatus or without
using java.awt.Graphics?

Sure. You can put a (J)Label (or other txt componenent) in
your applet for messages, or in a (J)Dialog, (J)Frame,
JWindow, JToolBar or JOptionPane.

There are other methods of producing a message as well,
but any of the above would probably be better.

HTH

Andrew T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top