Results 1 to 3 of 3

Thread: Problem with getParameter from HTMl file using param tag

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2007
    Posts
    39

    Problem with getParameter from HTMl file using param tag

    Hi I need help plese, could any one tell me how to Pass in avirable from the HTML file using the PARAM tag. Also, pass in parameters to specify the font and colour of the text that is drawn to the screen. I did creat an Applet to demostrate it but doesn't displeay the the name said Hello null insteat of hello Ali.

    Code:
    public class DrawName extends java.applet.Applet {
        String name;
        Color color;
         Font font;
        /** Initialization method that will be called after the applet is loaded
         *  into the browser.
         */
        public void init() {
           
          name = getParameter("name");  
          //color= getParameter("color");
          //font= getParameter("font");
            
        }
       
        // TODO overwrite start(), stop() and destroy() methods
    
        public void paint(Graphics g) {
            
            //g.setColor(color);
            g.drawString("Hello" + name ,50,30);
            
        }
    }
    HTML Code:
    <HTML>
    <HEAD>
       <TITLE>Applet HTML Page</TITLE>
    </HEAD>
    <BODY>
    <H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
    
    <P>
    <APPLET codebase="classes" code="DrawName.class" width=350 height=200>
        <param name="name" value="Ali">
    </APPLET>
    </P>
    
    <HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT>
    </BODY>
    </HTML>
    
    Last edited by omarali; Oct 9th, 2007 at 06:57 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width