confussed about showStatus in java.applet.Applet

Discussion in 'Java' started by yawnmoth, Aug 15, 2006.

  1. yawnmoth

    yawnmoth Guest

    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?
     
    yawnmoth, Aug 15, 2006
    #1
    1. Advertising

  2. yawnmoth wrote:
    > 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.
     
    Andrew Thompson, Aug 15, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    390
    Andrew Thompson
    Jan 13, 2005
  2. Replies:
    5
    Views:
    1,285
    Default User
    Jul 15, 2004
  3. Replies:
    3
    Views:
    286
  4. FB
    Replies:
    5
    Views:
    539
    Andrew Thompson
    Jan 11, 2008
  5. yawnmoth

    confussed about CSS expressions

    yawnmoth, Jul 21, 2006, in forum: Javascript
    Replies:
    0
    Views:
    79
    yawnmoth
    Jul 21, 2006
Loading...

Share This Page