Saturday, December 17, 2011

Get Applet Info

package org.best.example;

    /*
            Get Applet Info Example
            This java example shows how get applet information using getAppletInfo method
            of an Applet class.
    */
    
    /*
    <applet code="GetAppletInfoExample" width=400 height=200>
    </applet>
    */
    
    
    import java.applet.Applet;
    import java.awt.Graphics;
    
    public class GetAppletInfoExample extends Applet{
    
            public void paint(Graphics g){
                  
                    String info = getAppletInfo();
                    g.drawString(info,50,50);
            }
          
            /*
             * Applet class provides default implementation of getAppletInfo()
             * method which returns null.
             *
             * Your Applet class should override this method to provide useful
             * information like applet name,author name and copyright information.
             */
          
            public String getAppletInfo(){
                    String info = "";
                  
                    info = info + "GetAppletInfoExample";
                    info = info + "@java-examples.com";
                  
                    return info;
            }
    }

No comments: