Tuesday, December 27, 2011

Set Status Message in Applet Window

package org.best.example;
   
    /*
            Set Status Message in Applet Window Example
            This java example shows how to set a status message of an applet window
            using showStatus method of an Applet class.
    */
    
    /*
    <applet code="SetStatusMessageExample" width=200 height=200>
    </applet>
    */
    
    
    import java.applet.Applet;
    import java.awt.Graphics;
    
    public class SetStatusMessageExample extends Applet{
    
            public void paint(Graphics g){
                    /*
                     * Show status message in an Applet window using
                     * void showStatus(String msg) method of an applet class.
                     */
                  
                    //this will be displayed inside an applet
                    g.drawString("Show Status Example", 50, 50);
                  
                    //this will be displayed in a status bar of an applet window
                    showStatus("This is a status message of an applet window");
            }
    }

No comments: