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 / August 2006

Tip: Looking for answers? Try searching our database.

confussed about showStatus in java.applet.Applet

Thread view: 
yawnmoth - 15 Aug 2006 05:48 GMT
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?
Andrew Thompson - 15 Aug 2006 06:44 GMT
> I have a file - HelloWorld.java that uses showStatus - and test.html
> (that includes HelloWorld.class as an applet) - and...  showStatus
[quoted text clipped - 8 lines]
> 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.


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



©2008 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.